OnPlayerStateChange Problem Rep+
#1

Why this not working, i don't have any error while compliting, i wanna to create vehicles only for one team players
but that other players from other teams can't enter...


Код:
    	if(newstate == PLAYER_STATE_DRIVER)
	{
	    new CarCheck = GetPlayerVehicleID(playerid);
	    if(CarCheck == TCars[Silent])
	    {
     	if(gTeam[playerid] == BG)
			{
   		SendClientMessage(playerid,-1, "You are now driving the silent car!");
            }
     	else
            {
    	SendClientMessage(playerid, -1, "You do not have the keys for this car!");
    	RemovePlayerFromVehicle(playerid);
			}
		}
	}
	    return 1;

}
Reply
#2

PHP код:
#define MAX_CARS YOUR_MAX_HERE
enum TeamCars
{
    
Silent[MAX_CARS]
}
new 
TCars[TeamCars];
TCars[Silent][7] = AddStaticVehicle(409,951.8288,1746.9312,8.4484,181.2667,0,0); // autosa1
    
TCars[Silent][0] = AddStaticVehicle(409,952.1929,1721.2109,8.4484,358.7518,0,0); // autosa2
    
TCars[Silent][1] = AddStaticVehicle(490,983.0292,1745.5511,8.7755,88.6112,0,0); // autosa3
    
TCars[Silent][2] = AddStaticVehicle(490,982.9572,1740.3363,8.7782,88.3571,0,0); // autosa4
    
TCars[Silent][3] = AddStaticVehicle(490,984.3070,1726.1650,8.7813,89.8584,0,0); // autosa5
    
TCars[Silent][4] = AddStaticVehicle(490,984.1295,1721.9319,8.7816,93.5532,0,0); // autosa6
    
TCars[Silent][5] = AddStaticVehicle(487,948.2358,1782.3492,15.9712,82.4005,0,0); // autosa7
    
TCars[Silent][6] = AddStaticVehicle(487,942.9401,1686.4752,15.9707,270.9727,0,0); // autosa8
if(newstate == PLAYER_STATE_DRIVER)
    {
        new 
CarCheck GetPlayerVehicleID(playerid);
            for(new 
=0iMAX_CARSi++)
            {
        if(
CarCheck == TCars[Silent][i])
        {
                if(
gTeam[playerid] == BG)
        {
                    
SendClientMessage(playerid,-1"You are now driving the silent car!");
                }
               else
               {
                    
SendClientMessage(playerid, -1"You do not have the keys for this car!");
                    
RemovePlayerFromVehicle(playerid);
            }
        }
         }
    }
        return 
1;

Did not test, but should give you an idea of how it should be done
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)