PDA

View Full Version : Restricting Skins


Sting.
14/08/2017, 06:42 PM
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

Logic_
14/08/2017, 06:44 PM
Instead of using function use a variable to store the value. Which is going to be faster and easy to use.

Sting.
14/08/2017, 07:00 PM
Sorry, I'm still limited to basic scripting. Although I know about arrays, I'm honestly Rusty. Could you provide the code? Thanks.

FuNkYTheGreat
14/08/2017, 07:22 PM
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.

Sting.
14/08/2017, 07:41 PM
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?

Bolex_
14/08/2017, 07:58 PM
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;
}

Sting.
14/08/2017, 08:16 PM
Thanks, I'll try it out.