Mein Fahrzeugsystem für Teams funktioniert nicht [HILFE]

In 10 Minuten startet der nächtliche Backupvorgang! Es kann währenddessen (ca. 10 Minuten) zu Einschränkungen bei der Nutzung des Forums kommen
Weitere Infos findet ihr im Thema Backup des Forums
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
  • JO


    Ich habe mir für meinen neuen Server ein System überlegt mit Teams anstelle von aufwendigen variablen, die ich niemals begreifte (irgendwann soll es ein reallive serverwerden.) aber ich stoße nur auf Errors und komme nicht weiter. das Thema wird nicht zu lang:


    Errors:





    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
    SendClientMessage(playerid,COLOR_GREEN,"Du bist eingestiegen");
    new vid; //vehicle-id
    new vty; //vehicle-type
    new pte; //player-team
    new WP; //Wanteds
    vid= GetPlayerVehicleID(playerid); //definition vid
    vty= GetVehicleModel(vid); //definition vty
    pte=GetPlayerTeam(playerid); //definition pte
    WP=GetPlayerWantedLevel(playerid); //definition WP


    if (vty==523||vty==596||vty==430||vty==528||vty==597||vty==598||vty==599||vty==601) //PD-Cars
    {//PD-Cars
    if(pte ==2) //is player from team police
    {
    SendClientMessage(playerid,COLOR_GREEN,"U are allowed t drive"); //send message
    }
    else //is player no officer
    {
    RemovePlayerFromVehicle(playerid); //kick player from car
    SendClientMessage(playerid,COLOR_RED,"U arent allowed to drive PD-cars"); //send message
    if (WP==0) //if he has no wantedlevel
    {
    if (pte==1) //and he is zivilist (zivilists are team1)
    {
    SetPlayerWantedLevel(playerid,1);}}} //give 1WP
    }
    }
    }
    }
    else
    {
    //PD/FBI-Cars
    if (vty==427||vty==497)//cars for both teams
    {
    if(pte ==2||3) //if player is officer or agent
    {
    SendClientMessage(playerid,COLOR_GREEN,"U are allowed t drive"); //send message
    }
    else //is player no officer/agent
    {
    RemovePlayerFromVehicle(playerid); //kick from car
    SendClientMessage(playerid,COLOR_RED,"U arent allowed to drive PD-cars"); //send message
    if (WP==0) //if he has no wantedlevel
    {
    if (pte==1) //if he is zivilist
    {
    SetPlayerWantedLevel(playerid,1);}}} //give 1WP
    }
    }
    }
    }
    }
    else
    {//FBI cars
    if (vty==490)
    {
    if(pte ==3)//if player is agent
    {
    SendClientMessage(playerid,COLOR_GREEN,"U are allowed t drive"); //send message
    }
    else //he is not agent
    {
    RemovePlayerFromVehicle(playerid);//kick from car
    SendClientMessage(playerid,COLOR_RED,"U arent allowed to drive FBI-cars"); //send message
    if (WP==0) //if he has no wantedlevel
    {
    if (pte==1) //the player is zivilist
    {
    SetPlayerWantedLevel(playerid,1);//give 1WP
    }
    }
    }
    }
    }
    else
    {
    //Army
    if (vty==425||vty==432||vty==433||vty==470||vty==548)//army cars
    {
    if(pte ==4)//player is soldier
    {
    SendClientMessage(playerid,COLOR_GREEN,"U are allowed t drive");//send message
    }
    else //player is not soldier
    {
    RemovePlayerFromVehicle(playerid);//kick from car
    SendClientMessage(playerid,COLOR_RED,"Du bist kein Polizist");//send message
    if (WP==0)//if he has no wantedlevel
    {
    if (pte==1)//the player is zivilist
    {
    SetPlayerWantedLevel(playerid,1);}//give 1WP
    }
    }
    }
    }
    }
    }
    return 1;
    }


    Ich hoffe und glaube, ihr könnt mir helfen. Ich wäre euch MEGA dankbar. ^^

    Meine Klasse treibt mich irgendwann noch in den Wahnsinn :dash: :peng:

  • Willkommen auf Breadfish!


    Da waren mehr als 10 Klammerfehler drin, und andere Fehler. Ich hoffe, dass ich alle gesehen habe.
    Schreibe es so:
    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
    SendClientMessage(playerid,COLOR_GREEN,"Du bist eingestiegen");
    new vid; //vehicle-id
    new vty; //vehicle-type
    new pte; //player-team
    new WP; //Wanteds
    vid= GetPlayerVehicleID(playerid); //definition vid
    vty= GetVehicleModel(vid); //definition vty
    pte=GetPlayerTeam(playerid); //definition pte
    WP=GetPlayerWantedLevel(playerid); //definition WP

    if (vty==523||vty==596||vty==430||vty==528||vty==597||vty==598||vty==599||vty==601) //PD-Cars
    {
    //PD-Cars
    if(pte ==2) //is player from team police
    {
    SendClientMessage(playerid,COLOR_GREEN,"U are allowed t drive"); //send message
    }
    else //is player no officer
    {
    RemovePlayerFromVehicle(playerid); //kick player from car
    SendClientMessage(playerid,COLOR_RED,"U arent allowed to drive PD-cars"); //send message
    if (WP==0) //if he has no wantedlevel
    {
    if (pte==1) //and he is zivilist (zivilists are team1)
    {
    SetPlayerWantedLevel(playerid,1);
    }
    }
    }
    //give 1WP
    }
    //PD/FBI-Cars
    if (vty==427||vty==497)//cars for both teams
    {
    if(pte ==2||pte==3) //if player is officer or agent
    {
    SendClientMessage(playerid,COLOR_GREEN,"U are allowed t drive"); //send message
    }
    else //is player no officer/agent
    {
    RemovePlayerFromVehicle(playerid); //kick from car
    SendClientMessage(playerid,COLOR_RED,"U arent allowed to drive PD-cars"); //send message
    if (WP==0) //if he has no wantedlevel
    {
    if (pte==1) //if he is zivilist
    {
    SetPlayerWantedLevel(playerid,1);
    }
    }
    }
    //give 1WP
    }
    //FBI cars
    if (vty==490)
    {
    if(pte ==3)//if player is agent
    {
    SendClientMessage(playerid,COLOR_GREEN,"U are allowed t drive"); //send message
    }
    else //he is not agent
    {
    RemovePlayerFromVehicle(playerid);//kick from car
    SendClientMessage(playerid,COLOR_RED,"U arent allowed to drive FBI-cars"); //send message
    if (WP==0) //if he has no wantedlevel
    {
    if (pte==1) //the player is zivilist
    {
    SetPlayerWantedLevel(playerid,1);//give 1WP
    }
    }
    }
    }
    //Army
    if (vty==425||vty==432||vty==433||vty==470||vty==548)//army cars
    {
    if(pte ==4)//player is soldier
    {
    SendClientMessage(playerid,COLOR_GREEN,"U are allowed t drive");//send message
    }
    else //player is not soldier
    {
    RemovePlayerFromVehicle(playerid);//kick from car
    SendClientMessage(playerid,COLOR_RED,"Du bist kein Polizist");//send message
    if (WP==0)//if he has no wantedlevel
    {
    if (pte==1)//the player is zivilist
    {
    SetPlayerWantedLevel(playerid,1);
    }
    //give 1WP
    }
    }
    }
    }
    return 1;
    }