SA-MP Forums Archive
Help Team Cars - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help Team Cars (/showthread.php?tid=321112)



Help Team Cars - Dark Crow - 25.02.2012

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


AW: Help Team Cars - dalkgamler - 25.02.2012

where do you have is it inside ? in onplayerentervehicle?


Re: Help Team Cars - ryansheilds - 25.02.2012

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.");
        }
    }



Re: Help Team Cars - Dark Crow - 25.02.2012

yes onplayerentervehicle


AW: Help Team Cars - dalkgamler - 25.02.2012

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


Re: Help Team Cars - ryansheilds - 25.02.2012

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.");
             }
        }
    }