Certain score to enter vehicles
#1

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;
}
Reply
#2

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
Reply
#3

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)