Vehicle loop problem :/
#1

hi, I was writing something that when a player from a team steals a car he gets +1 wanted level, so I made a vehicle variable to check if the vehicle is stolen:
pawn Код:
//other code
else if(vehicle == 516)
        {
            for(new iv; iv<MAX_VEHICLES; iv++)// a loop that goes though all vehicles
            {
                if(gTeam[playerid] == TEAM_BANDIT)
                {
                    if(stolenveh[iv] == 0)
                    {
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "U stole a Drivers car, be carefull!");
                        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
                        new string[128];
                        format(string,sizeof(string),"%s has stolen a drivers car!",playerid);
                        SendClientMessageToAllCops(string);
                        stolenveh[iv] = 1;
                        return 1;
                    }
                    else if(stolenveh[iv] == 1)
                    {
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "This vehicle has been stolen!");
                    }
                }
            }
        }//other code
this must protect the player from getting a double wanted level, while entered the same car...
however when I steal the car; it says the messages, u stolen a drivers car!
but when I enter that same car again, I get +1 wanted level and I get the u have stolen a drivers car message + this vehicle has been stolen message :/
Reply


Messages In This Thread
Vehicle loop problem :/ - by knackworst - 31.08.2011, 08:22
Re: Vehicle loop problem :/ - by TTJJ - 31.08.2011, 08:34
Re: Vehicle loop problem :/ - by =WoR=Varth - 31.08.2011, 08:40
Re: Vehicle loop problem :/ - by knackworst - 31.08.2011, 09:03
Re: Vehicle loop problem :/ - by =WoR=Varth - 31.08.2011, 09:05
Re: Vehicle loop problem :/ - by knackworst - 31.08.2011, 09:16
Re: Vehicle loop problem :/ - by =WoR=Varth - 31.08.2011, 09:20
Re: Vehicle loop problem :/ - by FireCat - 31.08.2011, 09:22
Re: Vehicle loop problem :/ - by knackworst - 31.08.2011, 09:26
Re: Vehicle loop problem :/ - by =WoR=Varth - 31.08.2011, 09:31

Forum Jump:


Users browsing this thread: 1 Guest(s)