Onplayerstatechange help
#5

Quote:
Originally Posted by |∞|-Рцппσĵσ-|∞|
You really should learn to indent your script.
It'll be more readable, and easier to find errors.
http://forum.sa-mp.com/index.php?topic=61893.0

pawn Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
{
    new vehicleidd = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleidd) == 596 || GetVehicleModel(vehicleidd) == 523 || GetVehicleModel(vehicleidd) == 601 || GetVehicleModel(vehicleidd) == 432 || GetVehicleModel(vehicleidd) == 497)
    { //added a bracket here. After your *statement
        if(gTeam[playerid] == TEAM_COP || gTeam[playerid] == TEAM_ARMY)
        {
            SendClientMessage(playerid,0xF08080AA,"This vehicle belongs to the city. You can use this vehicle to do your job");
            return 1;
        }
        new plwl;
        GetPlayerName(playerid,pname,24);
        if(StoleCopCarRecent[playerid] == 0) //why not combine this with your other "StoleCopCarRecent" statement?
        {
            plwl = GetPlayerWantedLevel(playerid);
            SetPlayerWantedLevel(playerid,plwl +4);
        }
        new pcol = GetPlayerColor(playerid);
        plwl = GetPlayerWantedLevel(playerid);
        SendClientMessage(playerid, 0xA9A9A9AA, "|_Crime Commited_|");
        format(string1, sizeof(string1), "(LAW ENFORCEMENT VEHICLE THEFT) Wanted Level %d",plwl);
        SendClientMessage(playerid,pcol,string1);
        commitedcrimerecently[playerid] +=200;
        if(StoleCopCarRecent[playerid] == 0) //this one
        {
            for(new i=0;i<MAX_PLAYERS;i++)
            {
                new current_zone;
                current_zone = player_zone[playerid];
                if(LawEnforcementRadio[i] == 1)
                {
                    format(string1, sizeof(string1), "DISPATCH:(LAW ENFORCEMENT VEHICLE THEFT) %s(%d) Has stolen a police vehicle.Location: %s",pname,playerid,zones[current_zone][zone_name]);
                    SendClientMessage(i, COLOR_ROYALBLUE, string1);
                }
            }
        }
        StoleCopCarRecent[playerid] =1;//moved this into your *statement
    } //added a bracket to close your *statement
}
Thanks a lot, it works great. I will try to improve my indentation skills lol
Reply


Messages In This Thread
Onplayerstatechange help - by killdahobo99 - 17.08.2009, 17:50
Re: Onplayerstatechange help - by snoob - 17.08.2009, 18:22
Re: Onplayerstatechange help - by Correlli - 17.08.2009, 18:27
Re: Onplayerstatechange help - by Djiango - 17.08.2009, 18:52
Re: Onplayerstatechange help - by killdahobo99 - 17.08.2009, 19:09

Forum Jump:


Users browsing this thread: 1 Guest(s)