Report system - 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: Report system (
/showthread.php?tid=467990)
Report system -
Mattakil - 05.10.2013
it seems that if I do /report, it wont show if ID 1 is admin, and is the same thing for /a chat and /admins..idk what the fuck ive done wrong, im a noob.
pawn Код:
CMD:a(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new string[128],
amessage[100];
if(sscanf(params, "s[100]", amessage))
{
SendClientMessage(playerid, -1, "USAGE: /a [Text]");
return 1;
}
else
{
format(string, sizeof(string), "[Admin Chat] %s: %s", GetName(playerid), amessage);
foreach (new i : Player)
{
if(PlayerInfo[i][pAdmin] >= 1)
{
SendClientMessage(i, COLYELLOW, string);
return 1;
}
return 1;
}
}
}
return 1;
}
pawn Код:
CMD:admins(playerid, params[])
{
SCM(pid, COLYELLOW, "Admins Online:");
foreach(new i : Player)
{
if(PlayerInfo[i][pAdmin] >=1)
{
new name[100];
format(name, sizeof(name), "Admin %s {%d}",GetName(i), (i));
SCM(pid, COLWHITE, name);
return 1;
}
}
return 1;
}
CMD:report(playerid, params[])
{
new string[128];
// reportmessage[100];
if(strlen(params)>=100)return SCM(pid, COLRED, "[Server]{F0F0F0}: Max report length is 100.");
else
{
format(string, sizeof(string), "[Report] %s {%d}: %s", GetName(playerid), playerid, params);
SCM(pid, COLPURPLE, "Your message has been sent to online admins!");
foreach (new i : Player)
{
if(PlayerInfo[i][pAdmin] >=1)
{
SCM(i, COLPURPLE, string);
return 1;
}
}
}
return 1;
}
Re: Report system -
Mattakil - 05.10.2013
and yes, I know the /report should have if(sscanf whatever to it..I think im missing something with foreach on this one
Re: Report system -
Jefff - 05.10.2013
pawn Код:
CMD:admins(playerid)
{
new name[40];
SCM(playerid, COLYELLOW, "Admins Online:");
foreach(new i : Player)
{
if(PlayerInfo[i][pAdmin] >= 1)
{
format(name, sizeof(name), "Admin %s {%d}",GetName(i), i);
SCM(playerid, COLWHITE, name);
}
}
return 1;
}
dont use return in foreach because it stops loop
Re: Report system -
Mattakil - 05.10.2013
Oh thanks, I thought only returning 0 stopped the loop
Re: Report system -
Jefff - 05.10.2013
No
return; or return 35345345; stops too, or break;