Help Team Cars
#1

well i have followed a tutorial on making team cars anf it worked i made the cars and messages but theres a problem everyone can drive the car I put a RemovePlayerfromVehicle but it doesn't work!! it still lets ppl drive the car

here it is i have a stock also to check the cars

Код:
if(IsAYCar(vehicleid) && !ispassenger)
	 {
            if(PlayerInfo[playerid][pMember] == 6 ||PlayerInfo[playerid][pLeader] == 6)
            {
            SendClientMessage(playerid, COLOR_WHITE, "You are a member from the mafia.");
            }
	    else 
            { 
               SendClientMessage(playerid, COLOR_WHITE, "Ne ste del od mafijata.");               
                RemovePlayerFromVehicle(playerid);
            }

         }
How can i make it that only those members can drive the cars and when another player enters that isnt in that team he gets kicked from the car
Reply
#2

where do you have is it inside ? in onplayerentervehicle?
Reply
#3

Try this, its what I use "OnPlayerEnterVehicle":
pawn Код:
if(IsAYCar(vehicleid))
    {
        if(PlayerInfo[playerid][pMember] == 6||PlayerInfo[playerid][pLeader] == 6)
        {
             SendClientMessage(playerid, COLOR_WHITE, "You are a member from the mafia.");
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx, cy, cz);
            SendClientMessage(playerid, COLOR_WHITE, "Ne ste del od mafijata.");
        }
    }
Reply
#4

yes onplayerentervehicle
Reply
#5

i've done it OnPlayerStateChange if his state is driver i remove him.
Reply
#6

If that doesnt work use "OnPlayerStateChange" This code should work:
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {
        if(IsAYCar(vehicleid))
        {
             if(PlayerInfo[playerid][pMember] == 6||PlayerInfo[playerid][pLeader] == 6)
             {
                 SendClientMessage(playerid, COLOR_WHITE, "You are a member from the mafia.");
             }
             else
             {
                 RemovePlayerFromVehicle(playerid); return  SendClientMessage(playerid, COLOR_WHITE, "Ne ste del od mafijata.");
             }
        }
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)