Richlist help - 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: Richlist help (
/showthread.php?tid=609286)
Richlist help -
cielkute - 10.06.2016
Код:
CMD:richlist(playerid, params[])
{
new string[128], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1;
new HighestCash = -9999;
SendClientMessage(playerid, COLOR_GREEN, "Rich List:");
for(new x=0; x<MAX_PLAYERS; x++)
if(IsPlayerConnected(x))
if(GetPlayerMoney(x) >= HighestCash)
{
HighestCash = GetPlayerMoney(x);
Slot1 = x;
}
HighestCash = -9999;
for(new x=0; x<MAX_PLAYERS; x++)
if(IsPlayerConnected(x) && x != Slot1)
if(GetPlayerMoney(x) >= HighestCash)
{
HighestCash = GetPlayerMoney(x);
Slot2 = x;
}
HighestCash = -9999;
for(new x=0; x<MAX_PLAYERS; x++)
if(IsPlayerConnected(x) && x != Slot1 && x != Slot2)
if(GetPlayerMoney(x) >= HighestCash)
{
HighestCash = GetPlayerMoney(x);
Slot3 = x;
}
HighestCash = -9999;
for(new x=0; x<MAX_PLAYERS; x++)
if(IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3)
if(GetPlayerMoney(x) >= HighestCash)
{
HighestCash = GetPlayerMoney(x);
Slot4 = x;
}
format(string, sizeof(string), "(%d) Player %s - $%d", Slot1,PlayerName(Slot1),GetPlayerMoney(Slot1));
SendClientMessage(playerid, COLOR_WHITE, string);
if(Slot2 != -1){
format(string, sizeof(string), "(%d) Player %s - $%d", Slot2,PlayerName(Slot2),GetPlayerMoney(Slot2));
SendClientMessage(playerid, COLOR_WHITE, string);
}
if(Slot3 != -1){
format(string, sizeof(string), "(%d) Player %s - $%d", Slot3,PlayerName(Slot3),GetPlayerMoney(Slot3));
SendClientMessage(playerid, COLOR_WHITE, string);
}
if(Slot4 != -1){
format(string, sizeof(string), "(%d) Player %s - $%d", Slot4,PlayerName(Slot4),GetPlayerMoney(Slot4));
SendClientMessage(playerid, COLOR_WHITE, string);
}
TargetCMDMessage(playerid, playerid, "RICHLIST");
return 1;
}
how set 4 string 1 DIALOG_STYLE_MSGBOX?
Re: Richlist help -
Dayrion - 10.06.2016
You should use
strcat.
Example:
PHP код:
CMD:cmd(playerid)
{
new str[3000], str1[200];
if(!IsPlayerAdmin(playerid))
{
format(str1, sizeof(str1), RED_U"- "BLUE_U"/cmd1\n");
strcat(str, str1);
format(str1, sizeof(str1), RED_U"- "BLUE_U"/cmd2\n");
ShowPlayerDialog(playerid, DIALOG_DM_DMCMDS, DIALOG_STYLE_MSGBOX, "Available commands", str, "Ok", "");
return 1;
}
}
Re: Richlist help -
Jefff - 10.06.2016
Look here
https://sampforum.blast.hk/showthread.php?tid=574266
http://forum.sa-mp.com/showpost.php?...postcount=1760
Re: Richlist help -
Alpay0098 - 10.06.2016
You can define 5 strings like below:
PHP код:
new string1[256], string2[256], string3[256], string4[256], mainstring[1024];
format(string1, blah blah blah
format(string2, blah blah blah
format(string3, blah blah blah
format(string4, blah blah blah
format(mainstring, sizeof(mainstring), "%s \n%s \n%s \n%s", string1, string2, string3, string4);
ShowPlayerDialog(playerid, 69, DIALOG_STYLE_MSGBOX, "List of the rich people", mainstring, "Close", "");