SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/08/2016, 01:56 PM   #1
MrCallum
Huge Clucker
 
Join Date: Apr 2014
Location: I pulled that trigger because I'm a crazy nigge and I said
Posts: 440
Reputation: 2
Default CMD:wfdebt help

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;
}
MrCallum is offline   Reply With Quote
Old 25/08/2016, 02:03 PM   #2
DarkSkull
Huge Clucker
 
DarkSkull's Avatar
 
Join Date: Aug 2014
Location: Dubai, United Arab Emirates
Posts: 326
Reputation: 43
Default Re: CMD:wfdebt help

Code removed
Won't Work :P
DarkSkull is offline   Reply With Quote
Old 25/08/2016, 02:03 PM   #3
[XST]O_x
High-roller
 
[XST]O_x's Avatar
 
Join Date: Aug 2009
Posts: 1,962
Reputation: 94
Default Re: CMD:wfdebt help

pawn Code:
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.

Last edited by [XST]O_x; 25/08/2016 at 08:00 PM.
[XST]O_x is offline   Reply With Quote
Old 25/08/2016, 02:08 PM   #4
DarkSkull
Huge Clucker
 
DarkSkull's Avatar
 
Join Date: Aug 2014
Location: Dubai, United Arab Emirates
Posts: 326
Reputation: 43
Default Re: CMD:wfdebt help

Quote:
Originally Posted by [XST]O_x View Post
pawn Code:
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.
DarkSkull is offline   Reply With Quote
Old 25/08/2016, 02:11 PM   #5
MrCallum
Huge Clucker
 
Join Date: Apr 2014
Location: I pulled that trigger because I'm a crazy nigge and I said
Posts: 440
Reputation: 2
Default Re: CMD:wfdebt help

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

Code:
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;
}
MrCallum is offline   Reply With Quote
Old 25/08/2016, 02:22 PM   #6
DarkSkull
Huge Clucker
 
DarkSkull's Avatar
 
Join Date: Aug 2014
Location: Dubai, United Arab Emirates
Posts: 326
Reputation: 43
Default Re: CMD:wfdebt help

PHP Code:
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;

DarkSkull is offline   Reply With Quote
Old 25/08/2016, 03:00 PM   #7
MrCallum
Huge Clucker
 
Join Date: Apr 2014
Location: I pulled that trigger because I'm a crazy nigge and I said
Posts: 440
Reputation: 2
Default Re: CMD:wfdebt help

I fixed it, thanks
MrCallum is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 09:19 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.