{Help} Car Restrictions
#1

How would i go about restricting the army Tanks and Hunters to the Army Skin ONLY?
Reply
#2

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 425 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 432)
        {
            if(GetPlayerSkin(playerid) != 287)
            {
                new Float:x, Float:y, Float:z;
                GetPlayerPos(playerid,x,y,z);
                SetPlayerPos(playerid,x,y,z+3);
                SendClientMessage(playerid,-1,"Army members can only use this vehicle!");
            }
        }
    }
    return 1;
}
Reply
#3

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new model = GetVehicleModel(GetPlayerVehicleID(playerid));
        if((model == 425) || (model == 432))
        {
            if(GetPlayerSkin(playerid) != 287))
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, -1, "This vehicle is for army only!");
            }
        }
    }  
    return 1;
}
Reply
#4

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new playerskin = GetPlayerSkin(playerid);
    new vehid = GetVehicleModel(GetPlayerVehicleID(playerid);
    if(playerskin != 287)
    {
        if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_ENTER_VEHICLE_DRIVER)
        {
            if(vehid == 425) || vehid == 432)
            {
                ClearAnimations(playerid);
                SendClientMessage(playerid, -1 ,"You require to be a part of the army in order to enter this Hunter.");
            }
            else if(vehid == 432)
            {
                ClearAnimations(playerid);
                SendClientMessage(playerid, -1 ,"You require to be a part of the army in order to enter this Rhino.");
            }
        }
    }
    return 1;
}
I think this'll do the job
Reply
#5

Thanks Guys :P =rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)