Locking cars/Make them not able to /engine - 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: Locking cars/Make them not able to /engine (
/showthread.php?tid=131563)
Locking cars/Make them not able to /engine -
Mini` - 03.03.2010
Alright, I'm trying to set all the "useless" cars that are just for show, locked or take the ability to /engine them away.
I'd love to be able to lock them. But I'm unsure how... One way I haven't tried is OnPlayerEnterVehicle, I've tried to SetVehicleParamsForPlayer upon them spawning.. But it doesn't work.
My /engine command will Not allow cars (type 0) that are "useless" to be /engine'd.. (Meaning that part works, you can't start the engine of a car type 0, but when in an ownable car or a rentable car it is bugged.)
Код:
if(strcmp(cmd, "/engine", true) == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(DynamicCars[GetPlayerVehicleID(playerid)][CarType] != 0)
{
if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
{
TogglePlayerControllable(playerid,1);
EngineStatus[GetPlayerVehicleID(playerid)] = 1;
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"inserts his keys into the ignition and turns the engine on.");
}
else
{
PlayerActionMessage(playerid,15.0,"inserts her keys into the ignition and turns the engine on.");
}
} else
{
TogglePlayerControllable(playerid,0);
EngineStatus[GetPlayerVehicleID(playerid)] = 0;
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"has just put his car in park and turned the engine off.");
}
else
{
PlayerActionMessage(playerid,15.0,"has just put her car in park and turned the engine off.");
}
}
} else {
SendClientMessage(playerid, COLOR_WHITE, "You do not have keys to this car nor are there keys in the ignition.");
}
} else
{
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] You are not even in a car!");
}
return 1;
}