SA-MP Forums Archive
Please help me with this - 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: Please help me with this (/showthread.php?tid=387635)



Please help me with this - Majava - 25.10.2012

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[TEAM_BALLAS])
        {
            if(GetPlayerTeam(playerid) != TEAM_BALLAS) return SendClientMessage(playerid,COLOR_RED,"This is only for Ballas members!");
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car!");
                return 1;
            }
        }
So if player is not in TEAM_BALLAS it removes it from vehicle. Fix this or something my mind is going


AW: Please help me with this - Nero_3D - 25.10.2012

pawn Код:
//OnPlayerStateChange(playerid, newstate, oldstate)
    if(newstate == PLAYER_STATE_DRIVER) // use definitions, its easier
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[TEAM_BALLAS])
        {
            if(GetPlayerTeam(playerid) != TEAM_BALLAS) // removed the return
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car!");
            }
        }
That will only work with one vehicleid but I think you want to disable more vehicles
Show us the code where you store the vehicleids in Cars


Re: Please help me with this - Majava - 25.10.2012

didn't work.
pawn Код:
enum cInfo
{
    cTEAM_BALLAS,
    cTEAM_POLICE
}
new Cars[MAX_PLAYERS];
Cars like this...
pawn Код:
Cars[TEAM_BALLAS] = AddStaticVehicle(580,1807.2400,-1694.3062,13.2531,148.9250,0,0);
I have many teams police etc. Only ballas can enter ballas car. So like if team ballas = dont remove from car or something like that i just cant do it with pawn. Help!