Beiträge von Silvio.Castro

    Jz hab ich nen warning....


    Das bei OnPlayerConnect:



    Textdraw6[playerid] = CreatePlayerTextDraw(playerid, 140.000000, 357.000000, "Fahrzeug: string ");
    PlayerTextDrawBackgroundColor(playerid, Textdraw6 [playerid], 255);
    PlayerTextDrawFont(playerid ,Textdraw6 [playerid], 3);
    PlayerTextDrawLetterSize(playerid ,Textdraw6 [playerid], 0.250000, 1.000000);
    PlayerTextDrawColor(playerid ,Textdraw6 [playerid], -1);
    PlayerTextDrawSetOutline(playerid ,Textdraw6 [playerid], 0);
    PlayerTextDrawSetProportional(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetShadow(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetSelectable(playerid ,Textdraw6 [playerid], 0);


    Das bei OnPlayerStateChange



    new string[32];//Sollte völlig reichen
    format(string,sizeof string,"Fahrzeug: %s",PlayerVehicle[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    PlayerTextDrawSetString(playerid, Textdraw6[playerid], string);
    PlayerTextDrawShow(playerid, Textdraw6[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw7[playerid]);
    PlayerTextDrawShow(playerid, Textdraw8[playerid]);
    PlayerTextDrawShow(playerid, Textdraw9[playerid]);
    PlayerTextDrawShow(playerid, Textdraw10[playerid]);
    PlayerTextDrawShow(playerid, Textdraw11[playerid]);
    PlayerTextDrawShow(playerid, Textdraw12[playerid]);
    PlayerTextDrawShow(playerid, Textdraw13[playerid]);



    Das ist der warning:
    C:\Users\Spiele\Desktop\Server Ordner\Server Projekt\gamemodes\ServerProjekt.pwn(3232) : warning 219: local variable "string" shadows a variable at a preceding level

    Die anzeige von fahrzeug ist jz ausgeblendet...


    was muss ich ändern?


    So das ist jz bei OnPlayerConnect:

    Textdraw6[playerid] = CreatePlayerTextDraw(playerid, 140.000000, 357.000000, "Fahrzeug: Infernus");
    PlayerTextDrawBackgroundColor(playerid, Textdraw6 [playerid], 255);
    PlayerTextDrawFont(playerid ,Textdraw6 [playerid], 3);
    PlayerTextDrawLetterSize(playerid ,Textdraw6 [playerid], 0.250000, 1.000000);
    PlayerTextDrawColor(playerid ,Textdraw6 [playerid], -1);
    PlayerTextDrawSetOutline(playerid ,Textdraw6 [playerid], 0);
    PlayerTextDrawSetProportional(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetShadow(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetSelectable(playerid ,Textdraw6 [playerid], 0);


    Und das bei OnPlayerStateChange:


    if(oldstate == PLAYER_STATE_DRIVER)
    {
    new string[32];//Sollte völlig reichen
    format(string,sizeof string,"Fahrzeug: %s",PlayerVehicle[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    PlayerTextDrawSetString(playerid, Textdraw6[playerid], string);

    PlayerTextDrawHide(playerid, Textdraw6[playerid]);
    TextDrawHideForPlayer(playerid, Textdraw7[playerid]);
    PlayerTextDrawHide(playerid, Textdraw8[playerid]);
    PlayerTextDrawHide(playerid, Textdraw9[playerid]);
    PlayerTextDrawHide(playerid, Textdraw10[playerid]);
    PlayerTextDrawHide(playerid, Textdraw11[playerid]);
    PlayerTextDrawHide(playerid, Textdraw12[playerid]);
    PlayerTextDrawHide(playerid, Textdraw13[playerid]);
    }

    So das ist jz bei OnPlayerConnect:

    Textdraw6[playerid] = CreatePlayerTextDraw(playerid, 140.000000, 357.000000, "Fahrzeug: Infernus");
    PlayerTextDrawBackgroundColor(playerid, Textdraw6 [playerid], 255);
    PlayerTextDrawFont(playerid ,Textdraw6 [playerid], 3);
    PlayerTextDrawLetterSize(playerid ,Textdraw6 [playerid], 0.250000, 1.000000);
    PlayerTextDrawColor(playerid ,Textdraw6 [playerid], -1);
    PlayerTextDrawSetOutline(playerid ,Textdraw6 [playerid], 0);
    PlayerTextDrawSetProportional(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetShadow(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetSelectable(playerid ,Textdraw6 [playerid], 0);


    Und das bei OnPlayerStateChange:


    if(oldstate == PLAYER_STATE_DRIVER)
    {
    new string[32];//Sollte völlig reichen
    format(string,sizeof string,"Fahrzeug: %s",PlayerVehicle[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    PlayerTextDrawSetString(playerid, Textdraw6[playerid], string);

    PlayerTextDrawHide(playerid, Textdraw6[playerid]);
    TextDrawHideForPlayer(playerid, Textdraw7[playerid]);
    PlayerTextDrawHide(playerid, Textdraw8[playerid]);
    PlayerTextDrawHide(playerid, Textdraw9[playerid]);
    PlayerTextDrawHide(playerid, Textdraw10[playerid]);
    PlayerTextDrawHide(playerid, Textdraw11[playerid]);
    PlayerTextDrawHide(playerid, Textdraw12[playerid]);
    PlayerTextDrawHide(playerid, Textdraw13[playerid]);
    }

    hier wird es bei OnPalyerConnect erstellt:

    //Fahrzeugname
    Textdraw6[playerid] = CreatePlayerTextDraw(playerid, 140.000000, 357.000000, "Fahrzeug: Infernus");
    PlayerTextDrawBackgroundColor(playerid, Textdraw6 [playerid], 255);
    PlayerTextDrawFont(playerid ,Textdraw6 [playerid], 3);
    PlayerTextDrawLetterSize(playerid ,Textdraw6 [playerid], 0.250000, 1.000000);
    PlayerTextDrawColor(playerid ,Textdraw6 [playerid], -1);
    PlayerTextDrawSetOutline(playerid ,Textdraw6 [playerid], 0);
    PlayerTextDrawSetProportional(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetShadow(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetSelectable(playerid ,Textdraw6 [playerid], 0);

    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(newstate == PLAYER_STATE_DRIVER)
    {
    for(new i = 0; i < sizeof(LVPDCars); i++)
    {
    if(GetPlayerVehicleID(playerid) == LVPDCars[i])
    {
    if(sInfo[playerid][fraktion] == 2)
    {
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_BLUE, "Du bist kein Polizist");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    }
    }
    }

    if(oldstate == PLAYER_STATE_DRIVER)
    {
    TextDrawHideForPlayer(playerid, Textdraw7[playerid]);
    }

    if(oldstate==PLAYER_STATE_DRIVER)
    {
    PlayerTextDrawHide(playerid, Textdraw8[playerid]);
    }

    if(oldstate == PLAYER_STATE_DRIVER)
    {
    PlayerTextDrawHide(playerid, Textdraw9[playerid]);
    }


    if(oldstate==PLAYER_STATE_DRIVER)
    {
    PlayerTextDrawHide(playerid, Textdraw10[playerid]);
    }

    if(oldstate == PLAYER_STATE_DRIVER)
    {
    PlayerTextDrawHide(playerid, Textdraw11[playerid]);
    }


    if(oldstate==PLAYER_STATE_DRIVER)
    {
    PlayerTextDrawHide(playerid, Textdraw12[playerid]);
    }


    if(oldstate==PLAYER_STATE_DRIVER)
    {
    PlayerTextDrawHide(playerid, Textdraw13[playerid]);
    }


    if(newstate == PLAYER_STATE_DRIVER)
    {
    for(new i = 0; i < sizeof(MedicalCars); i++)
    {
    if(GetPlayerVehicleID(playerid) == MedicalCars[i])
    {
    if(sInfo[playerid][fraktion] == 15)
    {
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_BLUE, "Du bist kein Sanitäter");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    }
    }
    }


    if(newstate == PLAYER_STATE_DRIVER)
    {
    for(new i = 0; i < sizeof(OrdnungsAmtCars); i++)
    {
    if(GetPlayerVehicleID(playerid) == OrdnungsAmtCars[i])
    {
    if(sInfo[playerid][fraktion] == 5)
    {
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_BLUE, "Du bist kein Mitglied des Ordnungsamtes");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    }
    }
    }

    if(newstate == PLAYER_STATE_DRIVER)
    {
    for(new i = 0; i < sizeof(HitmanCars); i++)
    {
    if(GetPlayerVehicleID(playerid) == HitmanCars[i])
    {
    if(sInfo[playerid][fraktion] == 7)
    {
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_BLUE, "Du bist kein Hitman");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    }
    }
    }
    new w = GetPlayerWeapon(playerid);
    if((newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER) && w != 25 && w != 29 && w != 30 && w != 31) SetPlayerArmedWeapon(playerid, 0);

    if(newstate == PLAYER_STATE_DRIVER)
    {
    for(new i = 0; i < sizeof(SanNewsCars); i++)
    {
    if(GetPlayerVehicleID(playerid) == SanNewsCars[i])
    {
    if(sInfo[playerid][fraktion] == 6)
    {
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_BLUE, "Du bist kein Mitglied der San News");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    }
    }
    }

    if(newstate == PLAYER_STATE_DRIVER)
    {
    for(new i = 0; i < sizeof(Busse); i++)
    {
    if(GetPlayerVehicleID(playerid) == Busse[i])
    {
    if(sInfo[playerid][beruf] == 0)
    {
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_BLUE, "Du bist kein Busfahrer");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    }
    }
    }

    if(newstate == PLAYER_STATE_DRIVER)
    {
    //tacho textdraw
    TextDrawShowForPlayer(playerid, Textdraw6);
    TextDrawShowForPlayer(playerid, Textdraw7[playerid]);
    PlayerTextDrawShow(playerid, Textdraw8[playerid]);
    PlayerTextDrawShow(playerid, Textdraw9[playerid]);
    PlayerTextDrawShow(playerid, Textdraw10[playerid]);
    PlayerTextDrawShow(playerid, Textdraw11[playerid]);
    PlayerTextDrawShow(playerid, Textdraw12[playerid]);
    PlayerTextDrawShow(playerid, Textdraw13[playerid]);
    return 1;
    }


    if(newstate==PLAYER_STATE_DRIVER)
    {
    new vID=GetPlayerVehicleID(playerid);
    new vModel=GetVehicleModel(vID);


    for(new i=0; i<sizeof(autosOhneMotor); i++)
    {
    if(autosOhneMotor[i]!=vModel)continue;
    new tmp_engine,
    tmp_lights,
    tmp_alarm,
    tmp_doors,
    tmp_bonnet,
    tmp_boot,
    tmp_objective;
    //Motor an/ausschalten
    GetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    SetVehicleParamsEx(vID, 1, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    }


    for(new i=0; i<sizeof(ahCars); i++)
    {
    if(ahCars[i][id_x]!=vID)continue;
    //Verkaufsprozess
    SetPVarInt(playerid,"buyCarID",i);
    new string[256];
    format(string,sizeof(string),"Möchten sie das Fahrzeug für %i$ kaufen?",ahCars[i][c_preis]);
    ShowPlayerDialog(playerid,DIALOG_AUTOHAUS,DIALOG_STYLE_MSGBOX,"Autoverkauf",string,"Ja","Nein");
    break;
    }
    return 1;
    }
    return 1;
    }

    Hey,
    mein autohaus hat super funktiniert aber als ich das tachosystem angefangen hab gehts nichtmehr...
    Aber ich schick mal zur sicherheit die Dialoge hier rein.


    Das ifnewstate==change_driver:

    if(newstate==PLAYER_STATE_DRIVER)
    {
    new vID=GetPlayerVehicleID(playerid);
    new vModel=GetVehicleModel(vID);


    for(new i=0; i<sizeof(autosOhneMotor); i++)
    {
    if(autosOhneMotor[i]!=vModel)continue;
    new tmp_engine,
    tmp_lights,
    tmp_alarm,
    tmp_doors,
    tmp_bonnet,
    tmp_boot,
    tmp_objective;
    //Motor an/ausschalten
    GetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    SetVehicleParamsEx(vID, 1, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    }


    for(new i=0; i<sizeof(ahCars); i++)
    {
    if(ahCars[i][id_x]!=vID)continue;
    //Verkaufsprozess
    SetPVarInt(playerid,"buyCarID",i);
    new string[256];
    format(string,sizeof(string),"Möchten sie das Fahrzeug für %i$ kaufen?",ahCars[i][c_preis]);
    ShowPlayerDialog(playerid,DIALOG_AUTOHAUS,DIALOG_STYLE_MSGBOX,"Autoverkauf",string,"Ja","Nein");
    break;
    }
    return 1;
    }
    return 1;
    }


    Der Dialog:

    if(dialogid==DIALOG_AUTOHAUS)
    {
    if(response)
    {
    //Autoverkauf
    new id=GetPVarInt(playerid,"buyCarID");
    if(GetPlayerMoneyEx(playerid)<ahCars[id][c_preis])
    {
    SendClientMessage(playerid,COLOR_RED,"Du hast nicht genügend Geld.");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    GivePlayerMoneyEx(playerid,-ahCars[id][c_preis]);
    createPlayerCar(playerid,ahCars[id][model],ahInfo[ahCars[id][ah_id]][s_x],ahInfo[ahCars[id][ah_id]][s_y],ahInfo[ahCars[id][ah_id]][s_z],ahInfo[ahCars[id][ah_id]][s_r]);
    SendClientMessage(playerid,COLOR_GREEN,"Du hast das Auto erfolgreich gekauft");
    RemovePlayerFromVehicle(playerid);
    }
    else
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid,COLOR_RED,"Du hast den Kauf abgebrochen");
    }
    return 1;
    }

    Habs verstanden, mit dem timer stell ich ein alle wv milisekunden der tank 1% runter geht :)
    hab den jz auf 180000 gesetzt, das heisst alle 3min get der 1% runter :)


    Aber wenn du mir vlt. helfen könntest... hab nen textdraw edtor und ich möchte um das tacho eine kleine durchsichtigere box machen.... welchen textdraw editor sollte ich da nehmen? und wie füge ich eine box ein?


    Genau und wie füge ich die oben genannte funktion bei deisem textdraw ein:

    Textdraw8[playerid] = CreatePlayerTextDraw(playerid, 140.000000, 390.000000, "Tank: 100 %");
    PlayerTextDrawBackgroundColor(playerid ,Textdraw8 [playerid], 255);
    PlayerTextDrawFont(playerid ,Textdraw8 [playerid], 3);
    PlayerTextDrawLetterSize(playerid ,Textdraw8 [playerid], 0.320000, 0.899999);
    PlayerTextDrawColor(playerid ,Textdraw8 [playerid], -1);
    PlayerTextDrawSetOutline(playerid ,Textdraw8 [playerid], 0);
    PlayerTextDrawSetProportional(playerid ,Textdraw8 [playerid], 1);
    PlayerTextDrawSetShadow(playerid ,Textdraw8 [playerid], 1);
    PlayerTextDrawSetSelectable(playerid ,Textdraw8 [playerid], 0);

    Ah Hilfe!!
    PlayerTextDraws NIE in OnGameModeInit erstellen.


    Nutze dafür OnPlayerConnect, da kannst du auch die for Schleife weglassen.


    Das ist jz so bei ongamemodeini



    for(new playerid=0; playerid < MAX_PLAYERS; playerid++)
    Textdraw8[playerid] = CreatePlayerTextDraw(playerid, 140.000000, 390.000000, "Tank: 100 %");
    PlayerTextDrawBackgroundColor(playerid ,Textdraw8 [playerid], 255);
    PlayerTextDrawFont(playerid ,Textdraw8 [playerid], 3);
    PlayerTextDrawLetterSize(playerid ,Textdraw8 [playerid], 0.320000, 0.899999);
    PlayerTextDrawColor(playerid ,Textdraw8 [playerid], -1);
    PlayerTextDrawSetOutline(playerid ,Textdraw8 [playerid], 0);
    PlayerTextDrawSetProportional(playerid ,Textdraw8 [playerid], 1);
    PlayerTextDrawSetShadow(playerid ,Textdraw8 [playerid], 1);
    PlayerTextDrawSetSelectable(playerid ,Textdraw8 [playerid], 0);


    und jz bekomm ich diesen warning
    C:\Users\Spiele\Desktop\Server Ordner\Server Projekt\gamemodes\ServerProjekt.pwn(1330) : warning 219: local variable "playerid" shadows a variable at a preceding level

    Hei, hatte mal bock auf ne Mafia2 Montage :D
    Hoffe es gefällt euch :)
    Lasst natürlich konstruktive kritik da.
    Achja sollte das video nicht so ne gute auflösung haben dann wirds noch verarbeitet ;)


    Das Video


    Externer Inhalt www.youtube.com
    Inhalte von externen Seiten werden ohne Ihre Zustimmung nicht automatisch geladen und angezeigt.
    Durch die Aktivierung der externen Inhalte erklären Sie sich damit einverstanden, dass personenbezogene Daten an Drittplattformen übermittelt werden. Mehr Informationen dazu haben wir in unserer Datenschutzerklärung zur Verfügung gestellt.