12.02.2014, 13:59
Here is, took from my old CNR gamemode:
Top of script:
OnPlayerStateChange:
The command:
Top of script:
pawn Код:
new bool:LockVeh[MAX_PLAYERS];
pawn Код:
if(newstate == 2)
{
if(LockVeh[playerid] == true)
{
GameTextForPlayer(playerid, "~g~Vehicle Unlocked. Use /lock to lock it.", 5000, 5);
SendClientMessage(playerid,yellow,"Vehicle unlocked.Use /lock to lock it.");
LockVeh[playerid] = false;
}
pawn Код:
CMD:lock(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFAA,"You have to be inside a vehicle.");
if(PlayerInfo[playerid][pJailed] == 1) return SendClientMessage(playerid, red, "You cannot use this command in jail.");
if(LockVeh[playerid] == false)
{
GameTextForPlayer(playerid, "~r~Vehicle Locked. Use again /lock to unlock it.", 5000, 5);
SendClientMessage(playerid,yellow,"Vehicle locked.Use again /lock to unlock it.");
RemovePlayerFromVehicle(playerid);
LockVeh[playerid] = true;
for(new i=0; i < MAX_PLAYERS; i++)
{
if(i == playerid) continue;
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,1);
}
}
}
else
{
GameTextForPlayer(playerid, "~g~Vehicle Unlocked. Use /lock to lock it.", 5000, 5);
SendClientMessage(playerid,yellow,"Vehicle unlocked.Use /lock to lock it.");
LockVeh[playerid] = false;
for(new i=0; i < MAX_PLAYERS; i++)
{
if(i == playerid) continue;
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,0);
}
}
}
return 1;
}