SA-MP Forums Archive
how to lock this vehicle - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how to lock this vehicle (/showthread.php?tid=265477)



how to lock this vehicle - handerson - 01.07.2011

Quote:

if(GetVehicleModel(vehicleid) == 425 && GetPlayerScore(playerid) <150)
{
SendClientMessage(playerid, COLOR_RED, "You need to be a Colonel to ride a Hunter! [/Rankstats & /Myrank]");
//what think should i put
}

pls tell me how to make player cant enter those vehicle


Re: how to lock this vehicle - PrawkC - 01.07.2011

You should do this under the callback OnPlayerStateChange, then have it check if the newstate is PLAYER_STATE_DRIVER, then use your code + RemovePlayerFromVehicle


Re: how to lock this vehicle - Shadoww5 - 01.07.2011

if you want to lock do this:

PHP код:
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,0,bonnet,boot,objective); 
But if you don't want to let player enter the vehicle...

PHP код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(
newstate == 2)
    {
        if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 425 && GetPlayerScore(playerid) < 150)
        {
            
SendClientMessage(playeridCOLOR_RED"You need to be a Colonel to ride a Hunter! [/Rankstats & /Myrank]");
            
RemovePlayerFromVehicle(playerid);
        }
    }
    return 
1;