CMD:wfdebt help
#1

Can someone make the following Command as I am struggling to do so?

CMD:wfdebt(playerid, params[])
{
There would be a dialog with people who have money under 0 listed
return 1;
}
Reply
#2

Code removed
Won't Work :P
Reply
#3

pawn Код:
CMD:wfdebt(playerid, params[])
{
    new string[ 512 ];
    new cnt = 0;
    new name[ MAX_PLAYER_NAME + 1 ];
    foreach(new i: Player) {
        if(GetPlayerMoney(i) < 0) {
            cnt++;
            GetPlayerName(i, name, sizeof name);
            format(string, sizeof string, "%s\n%s", string, name);
        }
    }
    if(cnt == 0) {
        //No players in debt
    }
    else {
         ShowPlayerDialog(..., string, ...);
    }
    return 1;
}
Edit: Sorry, I forgot to take out the ShowPlayerDialog out of the loop. Fixed it now.
Reply
#4

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
pawn Код:
CMD:wfdebt(playerid, params[])
{
    new string[ 512 ];
    new cnt = 0;
    new name[ MAX_PLAYER_NAME + 1 ];
    foreach(new i: Player) {
        if(GetPlayerMoney(i) < 0) {
            cnt++;
            GetPlayerName(i, name, sizeof name);
            format(string, sizeof string, "%s\n%s", string, name);
        }
        if(cnt == 0) {
            //No players in debt
        }
        else {
             ShowPlayerDialog(..., string, ...);
        }
    }
    return 1;
}
That won't work becuase you're checking if the Money of the player is less than '0'.

EDIT: Sorry, I forgot about cash going negative, My bad.
Reply
#5

I've done it but need it in a dialog, anyone able to help?

Код:
CMD:wfdebt(playerid, params[])
{
	if(gTeam[playerid] == 2 || IsACop(playerid)|| PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pMember] == 7 && PlayerInfo[playerid][pRank] >= 6)
	{
		new string[128], x;

		SendClientMessageEx(playerid, COLOR_GREEN, "Current Wanted in Debt:");
		foreach(Player, i)
		{
			if(GetPlayerCash(i) < 0)
			{
				format(string, sizeof(string), "%s%s: %d", string,GetPlayerNameEx(i),GetPlayerCash(i));
				x++;
				if(x > 3) {
					SendClientMessageEx(playerid, COLOR_YELLOW, string);
					x = 0;
					format(string, sizeof(string), " ");
				} else {
					format(string, sizeof(string), "%s, ", string);
				}
			}
		}
		if(x <= 3 && x > 0)
		{
			string[strlen(string)-2] = '.';
			SendClientMessageEx(playerid, COLOR_YELLOW, string);
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GREY, "   You're not a Cop / Debt Collectors or Government");
	}
	return 1;
}
Reply
#6

PHP код:
CMD:wfdebt(playeridparams[])
{
    if(
gTeam[playerid] == || IsACop(playerid)|| PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pMember] == && PlayerInfo[playerid][pRank] >= 6)
    {
        new 
string[128], x;

        foreach(
Playeri)
        {
            if(
GetPlayerCash(i) < 0)
            {
                
format(stringsizeof(string), "%s\n%s: %d"string,GetPlayerNameEx(i),GetPlayerCash(i));
                
x++;
            }
        }
        if(
!= 0)
        {
            
ShowPlayerDialog(playerid100DIALOG_STYLE_MSGBOX"Current Players Wanted in Debt:"string"Okay"button2[]);
        } else {
            
// No players in debt
        
}
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GREY"   You're not a Cop / Debt Collectors or Government");
    }
    return 
1;

Reply
#7

I fixed it, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)