Restricting Skins
#1

Код:
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
Reply
#2

Instead of using function use a variable to store the value. Which is going to be faster and easy to use.
Reply
#3

Sorry, I'm still limited to basic scripting. Although I know about arrays, I'm honestly Rusty. Could you provide the code? Thanks.
Reply
#4

Код:
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.
Reply
#5

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?
Reply
#6

Код:
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;
}
Reply
#7

Thanks, I'll try it out.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)