21.04.2012, 11:11
Hello,i've maked this simple /lock command to lock and unlock cars (just in one cmd),but it spam the chat after i lock or unlock the car.
It spawns "Vehicle unlocked.Use /lock to lock it." and "Vehicle locked.Use again /lock to unlock it."
What's wrong?
pawn Код:
CMD:lock(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFAA,"You have to be inside a vehicle.");
for(new i=0; i < MAX_PLAYERS; i++)
{
if(i == playerid) continue;
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.");
LockVeh[playerid] = true;
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,1);
}else{
GameTextForPlayer(playerid, "~g~Vehicle Unlocked. Use /loc to lock it.", 5000, 5);
SendClientMessage(playerid,yellow,"Vehicle unlocked.Use /lock to lock it.");
LockVeh[playerid] = false;
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,0);
}
}
return 1;
}
What's wrong?