/complain Command Isn't Looping?
#1

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
Reply
#2

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
Reply
#3

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
Reply
#4

Thanks Skull Muncher Its Fixed

Ellie
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)