SA-MP Forums Archive
/complain Command Isn't Looping? - 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: /complain Command Isn't Looping? (/showthread.php?tid=293269)



/complain Command Isn't Looping? - Ely - 27.10.2011

My /Complant command isn't looping through all players so it sends the complant message to the admins?

when you /complain somebody the person who sent the complaint is only being checked if their a admin? not every single player

Please help me fix this loop Thanks!

Код:
dcmd_complain(playerid, params[])
{
    new id, pName[MAX_PLAYER_NAME], idName[MAX_PLAYER_NAME], report[128], string[128];
  	if(sscanf(params,"us[128]",id,report)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /complain (nick/id) (complaint) - Enter A Valid Nick / ID");
  	if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "That ID/Player Isn't Valid");
  	if(id == playerid) return SendClientMessage(playerid,COLOR_RED,"You Cannot Complain About Yourself.");
	GetPlayerName(playerid,pName,sizeof(pName));
 	GetPlayerName(id,idName,sizeof(idName));
	format(string,sizeof(string),"{FFFFFF}Complaint About {8E5FE1}%s(%d) {FFFFFF}Sent. ({00AAFF}%s{FFFFFF})",idName,id,report);
	SendClientMessage(playerid,COLOR_RED,string);
  	GameTextForPlayer(playerid, "~w~Complaint Sent", 3000, 4);
  	for(new i; i<MAX_PLAYERS; i++)
    if(PlayerInfo[playerid][pAdminLevel] >= 1)
    {
		format(report,sizeof(report),"{FFFFFF}Player {8E5FE1}%s(%d) {FFFFFF}Complained About {8E5FE1}%s(%d) {FFFFFF}({00AAFF}%s{FFFFFF})",pName,playerid,idName,id,report);
      	SendClientMessage(i,COLOR_RED,report);
      	GameTextForPlayer(i, "~r~Complaint ~w~Received", 5000, 4);
      	PlayerPlaySound(i, 1058, 0.0, 0.0, 10.0);
	}
    return 1;
}
Ellie


Re: /complain Command Isn't Looping? - skullmuncher1337 - 27.10.2011

pawn Код:
dcmd_complain(playerid, params[])
{
    new id, pName[MAX_PLAYER_NAME], idName[MAX_PLAYER_NAME], report[128], string[128];
    if(sscanf(params,"us[128]",id,report)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /complain (nick/id) (complaint) - Enter A Valid Nick / ID");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "That ID/Player Isn't Valid");
    if(id == playerid) return SendClientMessage(playerid,COLOR_RED,"You Cannot Complain About Yourself.");
    GetPlayerName(playerid,pName,sizeof(pName));
    GetPlayerName(id,idName,sizeof(idName));
    format(string,sizeof(string),"{FFFFFF}Complaint About {8E5FE1}%s(%d) {FFFFFF}Sent. ({00AAFF}%s{FFFFFF})",idName,id,report);
    SendClientMessage(playerid,COLOR_RED,string);
    GameTextForPlayer(playerid, "~w~Complaint Sent", 3000, 4);
    for(new i; i<MAX_PLAYERS; i++)
        {
              if(PlayerInfo[i][pAdminLevel] >= 1)
              {
        format(report,sizeof(report),"{FFFFFF}Player {8E5FE1}%s(%d) {FFFFFF}Complained About  {8E5FE1}%s(%d) {FFFFFF}({00AAFF}%s{FFFFFF})",pName,playerid,idName,id,report);
              SendClientMessage(i,COLOR_RED,report);
              GameTextForPlayer(i, "~r~Complaint ~w~Received", 5000, 4);
              PlayerPlaySound(i, 1058, 0.0, 0.0, 10.0);
          }
     }
    return 1;
}
Edit: Stupid Indentation lol


Re: /complain Command Isn't Looping? - Ely - 27.10.2011

Quote:
Originally Posted by skullmuncher1337
Посмотреть сообщение
pawn Код:
dcmd_complain(playerid, params[])
{
    new id, pName[MAX_PLAYER_NAME], idName[MAX_PLAYER_NAME], report[128], string[128];
    if(sscanf(params,"us[128]",id,report)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /complain (nick/id) (complaint) - Enter A Valid Nick / ID");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "That ID/Player Isn't Valid");
    if(id == playerid) return SendClientMessage(playerid,COLOR_RED,"You Cannot Complain About Yourself.");
    GetPlayerName(playerid,pName,sizeof(pName));
    GetPlayerName(id,idName,sizeof(idName));
    format(string,sizeof(string),"{FFFFFF}Complaint About {8E5FE1}%s(%d) {FFFFFF}Sent. ({00AAFF}%s{FFFFFF})",idName,id,report);
    SendClientMessage(playerid,COLOR_RED,string);
    GameTextForPlayer(playerid, "~w~Complaint Sent", 3000, 4);
    for(new i; i<MAX_PLAYERS; i++)
        {
              if(PlayerInfo[i][pAdminLevel] >= 1)
              {
        format(report,sizeof(report),"{FFFFFF}Player {8E5FE1}%s(%d) {FFFFFF}Complained About  {8E5FE1}%s(%d) {FFFFFF}({00AAFF}%s{FFFFFF})",pName,playerid,idName,id,report);
              SendClientMessage(i,COLOR_RED,report);
              GameTextForPlayer(i, "~r~Complaint ~w~Received", 5000, 4);
              PlayerPlaySound(i, 1058, 0.0, 0.0, 10.0);
          }
     }
    return 1;
}
Edit: Stupid Indentation lol
Thanks il try that in a minute

Ellie


Re: /complain Command Isn't Looping? - Ely - 28.10.2011

Thanks Skull Muncher Its Fixed

Ellie