SA-MP Forums Archive
Certain score to enter 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: Certain score to enter vehicles (/showthread.php?tid=419650)



Certain score to enter vehicles - Eminem 2ka9 - 01.03.2013

I need a restriction to be with vehicles, only to be drive-able if they have a certain score like 1000.

I need a restriction for Rhino, Hydra, Hunter.

(My current code) Which is not working.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(GetPlayerVehicleID(playerid) == 432)
    {
    if (newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerScore(playerid) < 1500)
                           {
        RemovePlayerFromVehicle(playerid);
        GameTextForPlayer(playerid,"~r~~h~200+~b~ Score Needed!",3000,3);
        //SendClientMessage(playerid, C_RED, "You need to have 250+ score to drive this Tank");
        }
    }
    }

    return 1;
}



Re: Certain score to enter vehicles - Patrick - 01.03.2013

Try this

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 432)
        {
            new score = GetPlayerScore(playerid);
            if(score == 1500)
            {
                RemovePlayerFromVehicle(playerid);
                GameTextForPlayer(playerid,"~r~~h~200+~b~ Score Needed!",3000,3);
            }
        }
    }
    return 1;
}

Cheers
PDS2012



Re: Certain score to enter vehicles - LarzI - 01.03.2013

Well first of all, you should check the state before the model.

Second of all, model != id. Vehicle ID and vehicle model are two different things. What you want is model.

Here's an example:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if( newstate == PLAYER_STATE_DRIVER )
    {
        if( GetVehicleModel( GetPlayerVehicleID( playerid )) == 432 )
        {
            if(GetPlayerScore(playerid) < 1500)
            {
                RemovePlayerFromVehicle( playerid );
                GameTextForPlayer( playerid, "~r~~h~1500+~b~ Score Needed!", 3000, 3 );
            }
        }
    }
    return true;
}