Vehice lock. - 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: Vehice lock. (
/showthread.php?tid=324043)
Vehice lock. -
viddo - 07.03.2012
Hello, I have a /v lock command that makes the player can't turn on the engine if he tried to steal it, But i want to make another lock that locks the door but i don't know how, Any ideas?
Re: Vehice lock. -
SnG.Scot_MisCuDI - 07.03.2012
Well, this is mine
pawn Код:
CMD:lock(playerid, params[]) {
if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be in a vehicle to use this command!");
if (GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be the driver of a vehicle to use this command");
new vID = GetPlayerVehicleID(playerid);
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
loop(i, MAX_PLAYERS) {
if (IsPlayerConnected(i) && i != playerid) {
SetVehicleParamsForPlayer(vID, i, 0, 1);
}
}
SetVehicleParamsForPlayer(vID, playerid, 0, 0);
SendClientMessage(playerid, COLOR_GREEN, "* Your vehicle is now locked.");
return 1;
}
Re: Vehice lock. -
Mike_Peterson - 07.03.2012
you could make both, or that u can only do the one that the player cant start the engine, when the player is in the car and does /v lock, and when then make another check to detect if the player is near the car, then use (parts of) scots code.