SA-MP Forums Archive
Scores for vehicles - 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: Scores for vehicles (/showthread.php?tid=613830)



Scores for vehicles - HassanShah - 01.08.2016

Hello there...
I Need to make a vehicle in which i'll need scores to sit in. I've placed hunters at different places by using MTA. Now I want that I'll need 800 scores to sit in the hunter... How can I make it help please?? tell me this with simple method....
Thank you in advance


Re: Scores for vehicles - Flake. - 01.08.2016

https://sampwiki.blast.hk/wiki/GetPlayerScore

PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    if(
GetVehicleModel(vehicleid) == HUNTER_ID//Change this to the hunters vehicle id
    
{
        if(
GetPlayerScore(playerid) != 5//If the players score isn't equal to 5 it'll kil them out 
        
{
            
RemovePlayerFromVehicle(playerid); //Kicking them out
            //Add more messages here if you want
        
}
    }
    return 
1;

Theres several ways of doing it, that's just one simple example


Re: Scores for vehicles - Stinged - 01.08.2016

https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle
https://sampwiki.blast.hk/wiki/GetVehicleModel

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (GetVehicleModel(vehicleid) == 425 && GetPlayerScore(playerid) < 800)
    {
        ClearAnimations(playerid);
    }
    return 1;
}
EDIT: @Flake. You shouldn't use !=, because then it will only work if the player has exactly that amount of score.


Re: Scores for vehicles - HassanShah - 01.08.2016

Thank you so much!!!! but @Stinged where can I put sendclientmessage like You need 800 scores to use this vehicle or any other msg..


Re: Scores for vehicles - FreAkeD - 01.08.2016

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (GetVehicleModel(vehicleid) == 425 && GetPlayerScore(playerid) < 800)
    {
        ClearAnimations(playerid);
        SendClientMessage(playerid, -1, "You need 800 score to fly this aircraft");
    }
    return 1;
}