prints message too many times and then gives unknown 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)
+--- Thread: prints message too many times and then gives unknown command (
/showthread.php?tid=635639)
prints message too many times and then gives unknown command -
DemME - 11.06.2017
PHP код:
COMMAND:rac(playerid, params[])
{
new string[128],sendername[MAX_PLAYER_NAME];
if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
if(GetPVarInt(playerid, "Admin") >= 3)
{
for(new v = 1; v <= MAX_VEHICLES; v++)
{
new bool:despawn = true;
foreach(new i : Player)
{
if(IsPlayerInAnyVehicle(i) && GetPlayerVehicleID(i) == v)
{
despawn = false;
}
}
if(despawn == true)
{
DespawnVehicle(v);
}
format(sendername, sizeof(sendername), "%s", PlayerInfo[playerid][pUsername]);
GiveNameSpace(sendername);
format(string, sizeof(string), "Server Action: All unoccupied vehicles has been despawned by Administrator %s (%s).", sendername, AdminName(playerid));
SendClientMessageToAllEx(COLOR_RED, string);
}
}
else SendClientMessage(playerid, COLOR_ERROR, "You do not have access to this command!");
return 1;
}
This is the line that does the issues -
PHP код:
format(string, sizeof(string), "Server Action: All unoccupied vehicles has been despawned by Administrator %s (%s).", sendername, AdminName(playerid));
It's printing it to all, but eventually it prints like 100 lines of it. and then says it's an unknown command.. ? what am I done wrong?
Re: prints message too many times and then gives unknown command -
Fairuz - 11.06.2017
Because it's inside the loop,maybe.Try to move them
Re: prints message too many times and then gives unknown command -
DemME - 11.06.2017
Quote:
Originally Posted by Dice_
Because it's inside the loop,maybe.Try to move them
|
Oh fuck, sorry didn't saw the loop the time does itself lol thanks for making me notice!