21.04.2012, 11:22
SendClientMessage is inside the loop, therefore it spams. Put the SendClientMessage outside of the loop.
if you do it e.g like this, it wont spam:
if you do it e.g like this, it wont spam:
pawn Код:
CMD:lock(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFAA,"You have to be inside a vehicle.");
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;
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 /loc 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;
}