Restricting Skins - 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: Restricting Skins (
/showthread.php?tid=639277)
Restricting Skins -
Sting. - 14.08.2017
Код:
if(GetVehicleModel(vehicleid) == 416)
{
if(GetPlayerSkin(playerid) < 274 && 275)
{
MedicPay[playerid] = SetTimerEx ("GivePlayerScore", 60000, true, "d", playerid);
GameTextForPlayer(playerid, "If you're hurt, /recover!", 2500, 3);
}
else
{
SetVehicleParamsForPlayer(vehicleid, playerid, false, true);
SendClientMessage(playerid, 0xFF0000FF, "You have to be a Paramedic to drive the Ambulance!");
}
}
Ok guys, I have this code, as you see above. I kinda only want the Ambulance available to both this skins 274 and 275 and restrict vehicle access to any other skins but when I tried it, its somehow inverted, as other skins are able to enter, but the skins I entered are locked out. Any ideas to fix this problem?!
+REP will be awarded. Thanks in advance.
P.S , forgot to say that its in OnPlayerEnterVehicle
Re: Restricting Skins -
Logic_ - 14.08.2017
Instead of using function use a variable to store the value. Which is going to be faster and easy to use.
Re: Restricting Skins -
Sting. - 14.08.2017
Sorry, I'm still limited to basic scripting. Although I know about arrays, I'm honestly Rusty. Could you provide the code? Thanks.
Re: Restricting Skins -
FuNkYTheGreat - 14.08.2017
Код:
if(GetVehicleModel(vehicleid) == 416)
{
if(GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 275)
{
MedicPay[playerid] = SetTimerEx ("GivePlayerScore", 60000, true, "d", playerid);
GameTextForPlayer(playerid, "If you're hurt, /recover!", 2500, 3);
}
else
{
SetVehicleParamsForPlayer(vehicleid, playerid, false, true);
SendClientMessage(playerid, 0xFF0000FF, "You have to be a Paramedic to drive the Ambulance!");
}
}
Maybe try this one.
Re: Restricting Skins -
Sting. - 14.08.2017
Hey Funky, happy Independence day by the way. Anyhow, I totally forgot to mention, I only want those 2 skins to be able to drive the Ambulance, but I want other people/ any skins to be able to get in as passenger. I totally forgot to mention that. I also tried it, and it doesn't allow other skins to get in as passenger and well I really need passengers to get in anytime but only the ambulance can be driven by Paramedics. Implementation of Code?
Re: Restricting Skins -
Bolex_ - 14.08.2017
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
{
if( GetVehicleModel(GetPlayerVehicleID( playerid )) == 416 )
{
if(GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 275)
{
MedicPay[playerid] = SetTimerEx ("GivePlayerScore", 60000, true, "d", playerid);
GameTextForPlayer(playerid, "If you're hurt, /recover!", 2500, 3);
}
else
{
RemovePlayerFromVehicle( playerid );
SetVehicleParamsForPlayer(vehicleid, playerid, false, true);
SendClientMessage(playerid, 0xFF0000FF, "You have to be a Paramedic to drive the Ambulance!");
}
}
}
return 1;
}
Re: Restricting Skins -
Sting. - 14.08.2017
Thanks, I'll try it out.