#4

It's a pretty simple thing, right?

First, find the callback you're going to be using. Probably OnPlayerStateChange. You want to compare for, like you already have, PLAYER_STATE_ONFOOT going to PLAYER_STATE_DRIVER. Add a check for teams.

Second, read this: https://sampwiki.blast.hk/wiki/ClearAnimations
- ClearAnimations(playerid) will stop the animation of getting in the car so the State won't change.

So...
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
         new veh = GetPlayerVehicleID(playerid);
         if((VehicleInfo[vehicleid][vteam] != 0) && (VehicleInfo[vehicleid][vteam] != PlayerInfo[playerid][pteam]))
         {
                 SendClientMessage(playerid,-1,"This vehicle is restricted.");
                 ClearAnimations(playerid);
         }
    }
    return 1;
}
Reply


Messages In This Thread
Cars - by nezo2001 - 14.12.2014, 16:04
Re: Cars - by SickAttack - 14.12.2014, 16:10
Re: Cars - by semara123 - 14.12.2014, 16:11
Re: Cars - by Lawbringer - 14.12.2014, 16:28
Re: Cars - by nezo2001 - 14.12.2014, 16:35

Forum Jump:


Users browsing this thread: 1 Guest(s)