SA-MP Forums Archive
[BUG/MISTAKE? WIth my /lock command - 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: [BUG/MISTAKE? WIth my /lock command (/showthread.php?tid=152517)



[BUG/MISTAKE? WIth my /lock command - Jay. - 04.06.2010

Yo i've made a /lock command & /unlock but, I've tested it and it spams the message saying Vehicle doors have been unlocked to unlock them /unlock


I have no idea why it spams it i only want the message to show once, I'm a pawn Begginer btw so go easy thanks



XtremE


EDIT: Lol i forgot to show my code


Код:
if(!strcmp(cmdtext,"/lock",true))
	{  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFF1400FF,"You must be in a vehicle to unlock the doors");
    for(new i=0; i < MAX_PLAYERS; i++)
    {
      if(i == playerid) continue;
      SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,1);
      SendClientMessage(playerid,0xE1FF00FF,"Vehicle doors have been locked type /unlock to unlock them");
      PlayerPlaySound(playerid,1137, 0.0, 0.0, 0.0);
    }
		return 1;
	}



Re: [BUG/MISTAKE? WIth my /lock command - MadeMan - 04.06.2010

pawn Код:
if(!strcmp(cmdtext,"/lock",true))
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFF1400FF,"You must be in a vehicle to unlock the doors");
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(i == playerid) continue;
        SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,1);
    }
    SendClientMessage(playerid,0xE1FF00FF,"Vehicle doors have been locked type /unlock to unlock them");
    PlayerPlaySound(playerid,1137, 0.0, 0.0, 0.0);
    return 1;
}



Re: [BUG/MISTAKE? WIth my /lock command - Jay. - 04.06.2010

Thanks what did i do wrong?


Re: [BUG/MISTAKE? WIth my /lock command - Flashy - 04.06.2010

The last but one bracket was moved


Re: [BUG/MISTAKE? WIth my /lock command - MadeMan - 04.06.2010

You had SendClientMessage inside the looping code.


Re: [BUG/MISTAKE? WIth my /lock command - Jay. - 04.06.2010

Quote:
Originally Posted by Flashy
The last but one bracket was moved
Oh lol thanks



Re: [BUG/MISTAKE? WIth my /lock command - Jay. - 04.06.2010

Quote:
Originally Posted by Flashy
The last but one bracket was moved
Ok thanks