SA-MP Forums Archive
Need some more help - 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: Need some more help (/showthread.php?tid=473062)



Need some more help - kingcrome - 01.11.2013

I want to make it so if someone does not have 10 score/exp they wont be able to go into a vehicle. Can anyone help?


Re: Need some more help - Tagathron - 01.11.2013

OnPlayerStateChange()
{
new pScore;

pScore = GetPlayerScore(playerid);

if(newstate==PLAYER_STATE_DRIVER && pScore < 10)
{
RemovePlayerFromVehicle(playerid);
}
}


Re: Need some more help - kingcrome - 01.11.2013

Can i make it a particular vehicle?


Re: Need some more help - Konstantinos - 01.11.2013

If you mean a specific modelid:
pawn Код:
// OnPlayerStateChange:
if( newstate == PLAYER_STATE_DRIVER && GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 411 && GetPlayerScore( playerid ) < 10 )
// Change the 411 to any valid modelid you want. 411 -> infernus
{
    RemovePlayerFromVehicle( playerid );
}
If you need a specific vehicleid (for a vehicle you've created and you know its vehicleid:
pawn Код:
// Let's say somewhere you've created a vehicle:
// it should be global:
// Specific_Veh = CreateVehicle( .. ); OR AddStaticVehicle( .. ); OR AddStaticVehicleEx( .. );

// OnPlayerStateChange:
if( newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID( playerid ) == Specific_Veh && GetPlayerScore( playerid ) < 10 )
{
    RemovePlayerFromVehicle( playerid );
}