SA-MP Forums Archive
help me with allowing vehicles with score - 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 me with allowing vehicles with score (/showthread.php?tid=479840)



help me with allowing vehicles with score - ReD_HunTeR - 07.12.2013

hello i need little help,
allowing Vehicle is there anything that Ex:
if player have 500 score then he can use the vehicle and if 0-499 he cant is there?, if yes pls tell me how can i do it.


Re: help me with allowing vehicles with score - BizzyD - 07.12.2013

Something like this, you have to edit it for your needs though.

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new veh = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_DRIVER)
	{
 		if((GetPlayerScore(playerid) < 500)
 		{
 		    if(veh == VEHICLEID)
 		    {
 		        RemovePlayerFromVehicle(playerid);
   			}
		}
	}
	return 1;
}



Re: help me with allowing vehicles with score - ReD_HunTeR - 07.12.2013

tryed but not working :/


Re: help me with allowing vehicles with score - Wizzy951 - 07.12.2013

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerScore(playerid) < 500)
                {
                RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Just a little changed.


Re: help me with allowing vehicles with score - ReD_HunTeR - 07.12.2013

wizzy you dont understand what i exactly means,
i mean that if someone need to use hunter he need to get 500 scores like this..


Re: help me with allowing vehicles with score - Loot - 07.12.2013

Example: if player score is less than 425, he wont be able to drive a Hunter(425).
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
     if(newstate == PLAYER_STATE_DRIVER)
     {
          if(!CanDriveVehicle(playerid))
          {
               RemovePlayerFromVehicle(playerid);
          }
     }
     return 1;
}

CanDriveVehicle(playerid) // If player score is higher than #vehicleid, he may drive the car, else - wont
    return (GetPlayerScore(playerid) > GetPlayerVehicleID(playerid));



Re: help me with allowing vehicles with score - Konstantinos - 07.12.2013

Quote:
Originally Posted by BlackBomb
Посмотреть сообщение
wizzy you dont understand what i exactly means,
i mean that if someone need to use hunter he need to get 500 scores like this..
You never said anything about specific vehicles.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
        {
            case 425:
            {
                if(GetPlayerScore(playerid) < 500)
                {
                    SendClientMessage(playerid, -1, "You need atleast 500 score to use that vehicle");
                    RemovePlayerFromVehicle(playerid);
                }
            }
        }
    }
    return 1;
}
That's for hunter. For other vehicle's models, use it like that: case 425, N, N:


Re: help me with allowing vehicles with score - ReD_HunTeR - 07.12.2013

thanks that work