{Help} Car Restrictions - 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} Car Restrictions (
/showthread.php?tid=558758)
{Help} Car Restrictions -
Thoma - 18.01.2015
How would i go about restricting the army Tanks and Hunters to the Army Skin ONLY?
Re: {Help} Car Restrictions -
Ironboy - 18.01.2015
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;
}
Re: {Help} Car Restrictions -
Schneider - 18.01.2015
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;
}
Re: {Help} Car Restrictions -
JaydenJason - 18.01.2015
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
Re: {Help} Car Restrictions -
Thoma - 18.01.2015
Thanks Guys :P =rep