onplayerstate fehler?

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(newstate==PLAYER_STATE_DRIVER)
    {
    if(GetPVarInt(playerid,"Autoführerschein")==0)
    {
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du hast noch keinen Führerschein!");
    SendClientMessage(playerid,COLOR_LIGHTRED,"Geh zur Fahrschule und besorg dir einen.");
    }
    else
    {
    SendClientMessage(playerid,COLOR_GREY,"Fahrzeug wird gestartet...");
    return 1;
    }
    for(new i=0; i<sizeof(grovecar); i++)
    {
    if(GetPlayerVehicleID(playerid)==grovecar[13] || GetPlayerVehicleID(playerid)==grovecar[14])
    {
    if(GetPVarInt(playerid,"Rang")<5 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 5.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[11] || GetPlayerVehicleID(playerid)==grovecar[12])
    {
    if(GetPVarInt(playerid,"Rang")<4 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 4.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[9] || GetPlayerVehicleID(playerid)==grovecar[10])
    {
    if(GetPVarInt(playerid,"Rang")<3 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 3.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[7] || GetPlayerVehicleID(playerid)==grovecar[8] || GetPlayerVehicleID(playerid)==grovecar[3] || GetPlayerVehicleID(playerid)==grovecar[4])
    {
    if(GetPVarInt(playerid,"Rang")<2 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 2.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[5] || GetPlayerVehicleID(playerid)==grovecar[6] || GetPlayerVehicleID(playerid)==grovecar[0] || GetPlayerVehicleID(playerid)==grovecar[1] || GetPlayerVehicleID(playerid)==grovecar[2])
    {
    if(GetPVarInt(playerid,"Rang")<0 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 1 oder Grove Urlauber.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    return 1;
    }
    return 1;
    }

    2 Mal editiert, zuletzt von Schmonk ()

  • was soll da nicht gehen?
    ist ja mal schön das man wieder raten darf

    also... Bei diesem Teil im Script passiert folgendes:


    Wenn ich Rang 4 bei Grove bin und versuche mit dem grovecar[13] zu fahren lässt er mich das tun obwohl ich eigentlich möchte, dass da nur alle Spieler die Rang 5 und Grove also Fraktion 1 sind können bzw. Admins im Adminduty...


    Ich hoffe ihr habt mein Problem verstanden^^


    Danke und lg


    Schmonk

  • ok das grove geht mal... aber was wenn ich ein 2.tes z.B. ballascars hinzufügen will... Da schreibt er mir wieder fahrzeug wird gestartet egal ob richtiger rang oder nicht...
    bitte nochmal um hilfe...
    dieser teil unten ist einfach unter dem groveteil eingefügt (ist richtig eingerückt auch)
    danke und lg



    for(new i=0; i<sizeof(ballascar); i++)
    {
    if(GetPlayerVehicleID(playerid)==ballascar[13] || GetPlayerVehicleID(playerid)==ballascar[14])
    {
    if(GetPVarInt(playerid,"Rang")<5 && GetPVarInt(playerid,"Fraktion")==2 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 5.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==ballascar[11] || GetPlayerVehicleID(playerid)==ballascar[12])
    {
    if(GetPVarInt(playerid,"Rang")<4 && GetPVarInt(playerid,"Fraktion")==2 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 4.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==ballascar[9] || GetPlayerVehicleID(playerid)==ballascar[10] || GetPlayerVehicleID(playerid)==ballascar[15])
    {
    if(GetPVarInt(playerid,"Rang")<3 && GetPVarInt(playerid,"Fraktion")==2 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 3.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==ballascar[8] || GetPlayerVehicleID(playerid)==ballascar[7] || GetPlayerVehicleID(playerid)==ballascar[6] || GetPlayerVehicleID(playerid)==ballascar[5])
    {
    if(GetPVarInt(playerid,"Rang")<2 && GetPVarInt(playerid,"Fraktion")==2 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 2.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==ballascar[4] || GetPlayerVehicleID(playerid)==ballascar[3] || GetPlayerVehicleID(playerid)==ballascar[2] || GetPlayerVehicleID(playerid)==ballascar[1] || GetPlayerVehicleID(playerid)==ballascar[0])
    {
    if(GetPVarInt(playerid,"Rang")<0 && GetPVarInt(playerid,"Fraktion")==2 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 1 oder Ballas Urlauber.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    return 1;
    }
    return 1;
    }

  • Führerscheinabfrage als letztes Abfragen, also ganz unten. Dann klappt es :thumbup:


    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(newstate==PLAYER_STATE_DRIVER)
    {
    for(new i=0; i<sizeof(grovecar); i++)
    {
    if(GetPlayerVehicleID(playerid)==grovecar[13] || GetPlayerVehicleID(playerid)==grovecar[14])
    {
    if(GetPVarInt(playerid,"Rang")<5 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 5.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[11] || GetPlayerVehicleID(playerid)==grovecar[12])
    {
    if(GetPVarInt(playerid,"Rang")<4 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 4.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[9] || GetPlayerVehicleID(playerid)==grovecar[10])
    {
    if(GetPVarInt(playerid,"Rang")<3 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 3.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[7] || GetPlayerVehicleID(playerid)==grovecar[8] || GetPlayerVehicleID(playerid)==grovecar[3] || GetPlayerVehicleID(playerid)==grovecar[4])
    {
    if(GetPVarInt(playerid,"Rang")<2 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 2.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[5] || GetPlayerVehicleID(playerid)==grovecar[6] || GetPlayerVehicleID(playerid)==grovecar[0] || GetPlayerVehicleID(playerid)==grovecar[1] || GetPlayerVehicleID(playerid)==grovecar[2])
    {
    if(GetPVarInt(playerid,"Rang")<0 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 1 oder Grove Urlauber.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPVarInt(playerid,"Autoführerschein")==0)
    {
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du hast noch keinen Führerschein!");
    SendClientMessage(playerid,COLOR_LIGHTRED,"Geh zur Fahrschule und besorg dir einen.");
    }
    if(GetPVarInt(playerid,"Autoführerschein")==1)
    {
    SendClientMessage(playerid,COLOR_GREY,"Fahrzeug wird gestartet...");
    return 1;
    }
    return 1;
    }
    return 1;
    }

  • so siehts bei mir aus... ich bekomm zwar keine errors aber trotzdem funkt es nicht...
    ich kann mit rang 0 wenn ich ballas bin auch die cars von rang 5 fahren...


    das is mein script...



    if(newstate==PLAYER_STATE_DRIVER)
    {
    for(new i=0; i<sizeof(grovecar); i++)
    {
    if(GetPlayerVehicleID(playerid)==grovecar[13] || GetPlayerVehicleID(playerid)==grovecar[14])
    {
    if(GetPVarInt(playerid,"Rang")<5 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 5.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[11] || GetPlayerVehicleID(playerid)==grovecar[12])
    {
    if(GetPVarInt(playerid,"Rang")<4 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 4.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[9] || GetPlayerVehicleID(playerid)==grovecar[10])
    {
    if(GetPVarInt(playerid,"Rang")<3 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 3.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[7] || GetPlayerVehicleID(playerid)==grovecar[8] || GetPlayerVehicleID(playerid)==grovecar[3] || GetPlayerVehicleID(playerid)==grovecar[4])
    {
    if(GetPVarInt(playerid,"Rang")<2 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 2.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==grovecar[5] || GetPlayerVehicleID(playerid)==grovecar[6] || GetPlayerVehicleID(playerid)==grovecar[0] || GetPlayerVehicleID(playerid)==grovecar[1] || GetPlayerVehicleID(playerid)==grovecar[2])
    {
    if(GetPVarInt(playerid,"Rang")<0 && GetPVarInt(playerid,"Fraktion")==1 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 1 oder Grove Urlauber.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPVarInt(playerid,"Autoführerschein")==0)
    {
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du hast noch keinen Führerschein!");
    SendClientMessage(playerid,COLOR_LIGHTRED,"Geh zur Fahrschule und besorg dir einen.");
    }
    else
    {
    SendClientMessage(playerid,COLOR_GREY,"Fahrzeug wird gestartet...");
    }
    return 1;
    }
    for(new i=0; i<sizeof(ballascar); i++)
    {
    if(GetPlayerVehicleID(playerid)==ballascar[13] || GetPlayerVehicleID(playerid)==ballascar[14])
    {
    if(GetPVarInt(playerid,"Rang")<5 && GetPVarInt(playerid,"Fraktion")==2 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 5.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==ballascar[11] || GetPlayerVehicleID(playerid)==ballascar[12])
    {
    if(GetPVarInt(playerid,"Rang")<4 && GetPVarInt(playerid,"Fraktion")==2 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 4.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==ballascar[9] || GetPlayerVehicleID(playerid)==ballascar[10] || GetPlayerVehicleID(playerid)==ballascar[15])
    {
    if(GetPVarInt(playerid,"Rang")<3 && GetPVarInt(playerid,"Fraktion")==2 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 3.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==ballascar[8] || GetPlayerVehicleID(playerid)==ballascar[7] || GetPlayerVehicleID(playerid)==ballascar[6] || GetPlayerVehicleID(playerid)==ballascar[5])
    {
    if(GetPVarInt(playerid,"Rang")<2 && GetPVarInt(playerid,"Fraktion")==2 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 2.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPlayerVehicleID(playerid)==ballascar[4] || GetPlayerVehicleID(playerid)==ballascar[3] || GetPlayerVehicleID(playerid)==ballascar[2] || GetPlayerVehicleID(playerid)==ballascar[1] || GetPlayerVehicleID(playerid)==ballascar[0])
    {
    if(GetPVarInt(playerid,"Rang")<0 && GetPVarInt(playerid,"Fraktion")==2 || GetPVarInt(playerid,"Adminduty")==1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist noch nicht Rang 1 oder Ballas Urlauber.");
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    return 1;
    }
    return 1;
    }
    else if(GetPVarInt(playerid,"Autoführerschein")==0)
    {
    new Float:x,Float:y,Float:z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(playerid,x,y+3,z);
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du hast noch keinen Führerschein!");
    SendClientMessage(playerid,COLOR_LIGHTRED,"Geh zur Fahrschule und besorg dir einen.");
    }
    else
    {
    SendClientMessage(playerid,COLOR_GREY,"Fahrzeug wird gestartet...");
    }
    }
    return 1;
    }
    *

  • das ist genau... falsch!!


    ich sagte doch.. Die Führerscheinabfrage ganz unten einfügen..


    .:: Aufbau ::.

    for(new i=0; i<grovecars; i++) //Rangabfrage bla bla bla..
    for(new i=0; i<ballascar; i++) //Rangabfrage bla bla bla..
    for(new i=0; i<lspdcar; i++) //Für Beispiel eingefügt
    for(new i=0; i<fbicar; i++) //Für Beispiel eingefügt
    Führerscheinabfrage //Immer ganz unten