ShowPlayerDialog help
#1

tried doing dialogs for the first time today, don't really use dialogs much but i've noticed having everything show up in the chat can be annoying, especially when you want to see the 30+ stats of a player.

I attempted a dialog, it compiled, but ingame it didn't work, would only show 2 lines then end.
Not sure whats up, i know i'm doing something wrong, just can't see where as i get no errors compiling.

PHP код:
CMD:stats(playerid,params[])
{
     new 
id;
     new 
PlayerName[MAX_PLAYER_NAME];
     
GetPlayerName(playeridPlayerNamesizeof(PlayerName));
     new 
string[50];
     
sscanf(params"u"id);
     if (
isnull(params))
     {
        
format(stringsizeof(string), "_Statistics for '%s'_"PlayerName);
        
SendClientMessage(playeridLIMEstring);
        
format(stringsizeof(string), "General Stats\n");
        
format(stringsizeof(string), "Money: %d\n"GetPlayerCash(playerid));
        
format(stringsizeof(string), "Score: $%d\n"GetPlayerScore(playerid));
        
format(stringsizeof(string), "Total Kills: %d\n"pInfo[playerid][pKills]);
        
format(stringsizeof(string), "Total Deaths: %d\n"pInfo[playerid][pDeaths]);
        
format(stringsizeof(string), "Moneybags Found: %0.2f\n"pInfo[playerid][pMoneyBags]);
        
format(stringsizeof(string), "Total Times Farted: %s\n"pInfo[playerid][pFarts]);
        
format(stringsizeof(string), "Spontaneous Combustions: %s\n"pInfo[playerid][pFartExp]);
        
format(stringsizeof(string), "Total Panadol Used: %s\n"pInfo[playerid][pPanadolUsed]);
        
format(stringsizeof(string), "Criminal Stats\n");
        
format(stringsizeof(string), "Total Players Robbed: %d\n"pInfo[playerid][pPlayerRobs]);
        
format(stringsizeof(string), "Total Times Robbed: %d\n"pInfo[playerid][pRobbedBy]);
        
format(stringsizeof(string), "Total 24/7s Robbed: %d\n"pInfo[playerid][p247Robs]);
        
format(stringsizeof(string), "Total Ammunations Robbed: %d\n"pInfo[playerid][pAmmuRobs]);
        
format(stringsizeof(string), "Total Banks Robbed: %d\n"pInfo[playerid][pBankRobs]);
        
format(stringsizeof(string), "Total Heists Done: %d\n"pInfo[playerid][pBankHeists]);
        
format(stringsizeof(string), "Total Times Jailed: %d\n"pInfo[playerid][pJails]);
        
format(stringsizeof(string), "Total Stars Attained: %d\n"pInfo[playerid][pStarsAtt]);
        
format(stringsizeof(string), "Total Drugs Purchased: %d\n"pInfo[playerid][pDrugsPurch]);
        
format(stringsizeof(string), "Total Drugs Sold: N/A\n");
        
format(stringsizeof(string), "Total Drugs Used: %d\n"pInfo[playerid][pDrugsUsed]);
        
format(stringsizeof(string), "[Police Stats]\n");
        
format(stringsizeof(string), "Total Arrests: %d\n"pInfo[playerid][pArrests]);
        
ShowPlayerDialog(playeridSTATS_DIALOGDIALOG_STYLE_MSGBOX"{FF6666}Player Stats for %s"PlayerName"Okay","");
     }
     else if(
IsPlayerConnected(id))
     {
        
format(stringsizeof(string), "_Statistics for '%s'_"PlayerName);
        
SendClientMessage(playeridLIMEstring);
        
format(stringsizeof(string), "General Stats\n");
        
format(stringsizeof(string), "Money: %d\n"GetPlayerCash(playerid));
        
format(stringsizeof(string), "Score: $%d\n"GetPlayerScore(playerid));
        
format(stringsizeof(string), "Total Kills: %d\n"pInfo[playerid][pKills]);
        
format(stringsizeof(string), "Total Deaths: %d\n"pInfo[playerid][pDeaths]);
        
format(stringsizeof(string), "Moneybags Found: %0.2f\n"pInfo[playerid][pMoneyBags]);
        
format(stringsizeof(string), "Total Times Farted: %s\n"pInfo[playerid][pFarts]);
        
format(stringsizeof(string), "Spontaneous Combustions: %s\n"pInfo[playerid][pFartExp]);
        
format(stringsizeof(string), "Total Panadol Used: %s\n"pInfo[playerid][pPanadolUsed]);
        
format(stringsizeof(string), "Criminal Stats\n");
        
format(stringsizeof(string), "Total Players Robbed: %d\n"pInfo[playerid][pPlayerRobs]);
        
format(stringsizeof(string), "Total Times Robbed: %d\n"pInfo[playerid][pRobbedBy]);
        
format(stringsizeof(string), "Total 24/7s Robbed: %d\n"pInfo[playerid][p247Robs]);
        
format(stringsizeof(string), "Total Ammunations Robbed: %d\n"pInfo[playerid][pAmmuRobs]);
        
format(stringsizeof(string), "Total Banks Robbed: %d\n"pInfo[playerid][pBankRobs]);
        
format(stringsizeof(string), "Total Heists Done: %d\n"pInfo[playerid][pBankHeists]);
        
format(stringsizeof(string), "Total Times Jailed: %d\n"pInfo[playerid][pJails]);
        
format(stringsizeof(string), "Total Stars Attained: %d\n"pInfo[playerid][pStarsAtt]);
        
format(stringsizeof(string), "Total Drugs Purchased: %d\n"pInfo[playerid][pDrugsPurch]);
        
format(stringsizeof(string), "Total Drugs Sold: N/A\n");
        
format(stringsizeof(string), "Total Drugs Used: %d\n"pInfo[playerid][pDrugsUsed]);
        
format(stringsizeof(string), "[Police Stats]\n");
        
format(stringsizeof(string), "Total Arrests: %d\n"pInfo[playerid][pArrests]);
        
ShowPlayerDialog(playeridSTATS_DIALOGDIALOG_STYLE_MSGBOX"{FF6666}Player Stats for %s"PlayerName"Okay","");
     }
     else 
SendClientMessage(playerid,RED,"[ERROR]: Player is not connected");
     return 
1;

Reply
#2

CMDtats(playerid,params[])
{
new id;
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
new string[50];
sscanf(params, "u", id);
if (isnull(params))
{
format(string, sizeof(string), "_Statistics for '%s'_", PlayerName);
SendClientMessage(playerid, LIME, string);
format(string, sizeof(string), "General Stats\n");
format(string, sizeof(string), "Money: %d\n", GetPlayerCash(playerid));
format(string, sizeof(string), "Score: $%d\n", GetPlayerScore(playerid));
format(string, sizeof(string), "Total Kills: %d\n", pInfo[playerid][pKills]);
format(string, sizeof(string), "Total Deaths: %d\n", pInfo[playerid][pDeaths]);
format(string, sizeof(string), "Moneybags Found: %0.2f\n", pInfo[playerid][pMoneyBags]);
format(string, sizeof(string), "Total Times Farted: %s\n", pInfo[playerid][pFarts]);
format(string, sizeof(string), "Spontaneous Combustions: %s\n", pInfo[playerid][pFartExp]);
format(string, sizeof(string), "Total Panadol Used: %s\n", pInfo[playerid][pPanadolUsed]);
format(string, sizeof(string), "Criminal Stats\n");
format(string, sizeof(string), "Total Players Robbed: %d\n", pInfo[playerid][pPlayerRobs]);
format(string, sizeof(string), "Total Times Robbed: %d\n", pInfo[playerid][pRobbedBy]);
format(string, sizeof(string), "Total 24/7s Robbed: %d\n", pInfo[playerid][p247Robs]);
format(string, sizeof(string), "Total Ammunations Robbed: %d\n", pInfo[playerid][pAmmuRobs]);
format(string, sizeof(string), "Total Banks Robbed: %d\n", pInfo[playerid][pBankRobs]);
format(string, sizeof(string), "Total Heists Done: %d\n", pInfo[playerid][pBankHeists]);
format(string, sizeof(string), "Total Times Jailed: %d\n", pInfo[playerid][pJails]);
format(string, sizeof(string), "Total Stars Attained: %d\n", pInfo[playerid][pStarsAtt]);
format(string, sizeof(string), "Total Drugs Purchased: %d\n", pInfo[playerid][pDrugsPurch]);
format(string, sizeof(string), "Total Drugs Sold: N/A\n");
format(string, sizeof(string), "Total Drugs Used: %d\n", pInfo[playerid][pDrugsUsed]);
format(string, sizeof(string), "[Police Stats]\n");
format(string, sizeof(string), "Total Arrests: %d\n", pInfo[playerid][pArrests]);
ShowPlayerDialog(playerid, STATS_DIALOG, DIALOG_STYLE_MSGBOX, "{FF6666}Player Stats for %s", PlayerName, "Okay","");
}
else if(IsPlayerConnected(id))
{
format(string, sizeof(string), "_Statistics for '%s'_", PlayerName);
SendClientMessage(playerid, LIME, string);
format(string, sizeof(string), "General Stats\n");
format(string, sizeof(string), "Money: %d\n", GetPlayerCash(playerid));
format(string, sizeof(string), "Score: $%d\n", GetPlayerScore(playerid));
format(string, sizeof(string), "Total Kills: %d\n", pInfo[playerid][pKills]);
format(string, sizeof(string), "Total Deaths: %d\n", pInfo[playerid][pDeaths]);
format(string, sizeof(string), "Moneybags Found: %0.2f\n", pInfo[playerid][pMoneyBags]);
format(string, sizeof(string), "Total Times Farted: %s\n", pInfo[playerid][pFarts]);
format(string, sizeof(string), "Spontaneous Combustions: %s\n", pInfo[playerid][pFartExp]);
format(string, sizeof(string), "Total Panadol Used: %s\n", pInfo[playerid][pPanadolUsed]);
format(string, sizeof(string), "Criminal Stats\n");
format(string, sizeof(string), "Total Players Robbed: %d\n", pInfo[playerid][pPlayerRobs]);
format(string, sizeof(string), "Total Times Robbed: %d\n", pInfo[playerid][pRobbedBy]);
format(string, sizeof(string), "Total 24/7s Robbed: %d\n", pInfo[playerid][p247Robs]);
format(string, sizeof(string), "Total Ammunations Robbed: %d\n", pInfo[playerid][pAmmuRobs]);
format(string, sizeof(string), "Total Banks Robbed: %d\n", pInfo[playerid][pBankRobs]);
format(string, sizeof(string), "Total Heists Done: %d\n", pInfo[playerid][pBankHeists]);
format(string, sizeof(string), "Total Times Jailed: %d\n", pInfo[playerid][pJails]);
format(string, sizeof(string), "Total Stars Attained: %d\n", pInfo[playerid][pStarsAtt]);
format(string, sizeof(string), "Total Drugs Purchased: %d\n", pInfo[playerid][pDrugsPurch]);
format(string, sizeof(string), "Total Drugs Sold: N/A\n");
format(string, sizeof(string), "Total Drugs Used: %d\n", pInfo[playerid][pDrugsUsed]);
format(string, sizeof(string), "[Police Stats]\n");
format(string, sizeof(string), "Total Arrests: %d\n", pInfo[playerid][pArrests]);
ShowPlayerDialog(playerid, STATS_DIALOG, DIALOG_STYLE_MSGBOX, "{FF6666}Player Stats for %s", PlayerName, "Okay","");
}
else
{
SendClientMessage(playerid,RED,"[ERROR]: Player is not connected");
}
return 1;
}
Reply
#3

Try this
Код:
CMD:stats(playerid,params[]) 
{ 
new id; 
new PlayerName[MAX_PLAYER_NAME]; 
GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); 
new string[50]; 
sscanf(params, "u", id); 
if (isnull(params)) 
{ 
format(string, sizeof(string), "_Statistics for '%s'_", PlayerName); 
SendClientMessage(playerid, LIME, string); 
format(string, sizeof(string), "General Stats\n"); 
format(string, sizeof(string), "Money: %d\n", GetPlayerCash(playerid)); 
format(string, sizeof(string), "Score: $%d\n", GetPlayerScore(playerid)); 
format(string, sizeof(string), "Total Kills: %d\n", pInfo[playerid][pKills]); 
format(string, sizeof(string), "Total Deaths: %d\n", pInfo[playerid][pDeaths]); 
format(string, sizeof(string), "Moneybags Found: %0.2f\n", pInfo[playerid][pMoneyBags]); 
format(string, sizeof(string), "Total Times Farted: %s\n", pInfo[playerid][pFarts]); 
format(string, sizeof(string), "Spontaneous Combustions: %s\n", pInfo[playerid][pFartExp]); 
format(string, sizeof(string), "Total Panadol Used: %s\n", pInfo[playerid][pPanadolUsed]); 
format(string, sizeof(string), "Criminal Stats\n"); 
format(string, sizeof(string), "Total Players Robbed: %d\n", pInfo[playerid][pPlayerRobs]); 
format(string, sizeof(string), "Total Times Robbed: %d\n", pInfo[playerid][pRobbedBy]); 
format(string, sizeof(string), "Total 24/7s Robbed: %d\n", pInfo[playerid][p247Robs]); 
format(string, sizeof(string), "Total Ammunations Robbed: %d\n", pInfo[playerid][pAmmuRobs]); 
format(string, sizeof(string), "Total Banks Robbed: %d\n", pInfo[playerid][pBankRobs]); 
format(string, sizeof(string), "Total Heists Done: %d\n", pInfo[playerid][pBankHeists]); 
format(string, sizeof(string), "Total Times Jailed: %d\n", pInfo[playerid][pJails]); 
format(string, sizeof(string), "Total Stars Attained: %d\n", pInfo[playerid][pStarsAtt]); 
format(string, sizeof(string), "Total Drugs Purchased: %d\n", pInfo[playerid][pDrugsPurch]); 
format(string, sizeof(string), "Total Drugs Sold: N/A\n"); 
format(string, sizeof(string), "Total Drugs Used: %d\n", pInfo[playerid][pDrugsUsed]); 
format(string, sizeof(string), "[Police Stats]\n"); 
format(string, sizeof(string), "Total Arrests: %d\n", pInfo[playerid][pArrests]); 
ShowPlayerDialog(playerid, STATS_DIALOG, DIALOG_STYLE_MSGBOX, "{FF6666}Player Stats for %s", PlayerName, "Okay",""); 
} 
else if(IsPlayerConnected(id)) 
{ 
format(string, sizeof(string), "_Statistics for '%s'_", PlayerName); 
SendClientMessage(playerid, LIME, string); 
format(string, sizeof(string), "General Stats\n"); 
format(string, sizeof(string), "Money: %d\n", GetPlayerCash(playerid)); 
format(string, sizeof(string), "Score: $%d\n", GetPlayerScore(playerid)); 
format(string, sizeof(string), "Total Kills: %d\n", pInfo[playerid][pKills]); 
format(string, sizeof(string), "Total Deaths: %d\n", pInfo[playerid][pDeaths]); 
format(string, sizeof(string), "Moneybags Found: %0.2f\n", pInfo[playerid][pMoneyBags]); 
format(string, sizeof(string), "Total Times Farted: %s\n", pInfo[playerid][pFarts]); 
format(string, sizeof(string), "Spontaneous Combustions: %s\n", pInfo[playerid][pFartExp]); 
format(string, sizeof(string), "Total Panadol Used: %s\n", pInfo[playerid][pPanadolUsed]); 
format(string, sizeof(string), "Criminal Stats\n"); 
format(string, sizeof(string), "Total Players Robbed: %d\n", pInfo[playerid][pPlayerRobs]); 
format(string, sizeof(string), "Total Times Robbed: %d\n", pInfo[playerid][pRobbedBy]); 
format(string, sizeof(string), "Total 24/7s Robbed: %d\n", pInfo[playerid][p247Robs]); 
format(string, sizeof(string), "Total Ammunations Robbed: %d\n", pInfo[playerid][pAmmuRobs]); 
format(string, sizeof(string), "Total Banks Robbed: %d\n", pInfo[playerid][pBankRobs]); 
format(string, sizeof(string), "Total Heists Done: %d\n", pInfo[playerid][pBankHeists]); 
format(string, sizeof(string), "Total Times Jailed: %d\n", pInfo[playerid][pJails]); 
format(string, sizeof(string), "Total Stars Attained: %d\n", pInfo[playerid][pStarsAtt]); 
format(string, sizeof(string), "Total Drugs Purchased: %d\n", pInfo[playerid][pDrugsPurch]); 
format(string, sizeof(string), "Total Drugs Sold: N/A\n"); 
format(string, sizeof(string), "Total Drugs Used: %d\n", pInfo[playerid][pDrugsUsed]); 
format(string, sizeof(string), "[Police Stats]\n"); 
format(string, sizeof(string), "Total Arrests: %d\n", pInfo[playerid][pArrests]); 
ShowPlayerDialog(playerid, STATS_DIALOG, DIALOG_STYLE_MSGBOX, "{FF6666}Player Stats for %s", PlayerName, "Okay",""); 
}
else
{
SendClientMessage(playerid,RED,"[ERROR]: Player is not connected"); 
}
return 1; 
}
Reply
#4

still doesn't work. I can't see what you've changed, but yeah, its still not working.

heres a pic:

Reply
#5

Quote:
Originally Posted by tommzy09
Посмотреть сообщение
still doesn't work. I can't see what you've changed, but yeah, its still not working.

heres a pic:
ShowPlayerDialog(playerid, STATS_DIALOG, DIALOG_STYLE_MSGBOX, "{FF6666}Player Stats for %s",--> PlayerName, "Okay","");


ur just showin em their name


use

format(string, sizeof(string), "{FF6666}Player stats for $s", PlayerName);
ShowPlayerDialog(playerid, STATS_DIALOG, DIALOG_STYLE_MSGBOX, string...
Reply
#6

Quote:
Originally Posted by Trucido
Посмотреть сообщение
ShowPlayerDialog(playerid, STATS_DIALOG, DIALOG_STYLE_MSGBOX, "{FF6666}Player Stats for %s",--> PlayerName, "Okay","");


ur just showin em their name


use

format(string, sizeof(string), "{FF6666}Player stats for $s", PlayerName);
ShowPlayerDialog(playerid, STATS_DIALOG, DIALOG_STYLE_MSGBOX, string...
THIS ^^
Reply
#7

i see what you mean, how would i go about showing them all the stats i listed without making multiple dialogs?


edit:

this was my attempt

PHP код:
        format(stringsizeof(string), "{FF6666}Player stats for %s\nGeneral Stats\nMoney: $%d\nScore: %d\n"PlayerNameGetPlayerCash(playerid), GetPlayerScore(playerid));
        
ShowPlayerDialog(playeridSTATS_DIALOGDIALOG_STYLE_MSGBOXstring"Okay",""); 
but i get the error: "warning 202: number of arguments does not match definition"


edit 2: okay after some trial and error, i got it mostly working, just 1 more problem



how do i get that %s to show the players name?

here's my code:

PHP код:
        format(stringsizeof(string), "General Stats\nMoney: $%d\nScore: %d\n"GetPlayerCash(playerid), GetPlayerScore(playerid));
        
ShowPlayerDialog(playeridSTATS_DIALOGDIALOG_STYLE_MSGBOX"{FF6666}Player Stats for %s"string"Okay",""); 
Reply
#8

Quote:
Originally Posted by tommzy09
Посмотреть сообщение
i see what you mean, how would i go about showing them all the stats i listed without making multiple dialogs?
ok so try this.



PHP код:
CMD:stats(playerid,params[])
{
       new 
id;
     new 
PlayerName[MAX_PLAYER_NAME];
     
GetPlayerName(playeridPlayerNamesizeof(PlayerName));
     new 
string[1028], tmp[50];
     
sscanf(params"u"id);
     if (
isnull(params))
     {
        
format(stringsizeof(string), "_Statistics for '%s'_"PlayerName);
        
SendClientMessage(playeridLIMEstring);
        
format(tmpsizeof(tmp), "General Stats\n");
        
strcat(stringtmp);
                
format(tmpsizeof(tmp), "Money: %d\n"GetPlayerCash(playerid));
        
strcat(stringtmp);
               
format(tmpsizeof(tmp), "Score: $%d\n"GetPlayerScore(playerid));
        
strcat(stringtmp);
                
format(tmpsizeof(tmp), "Total Kills: %d\n"pInfo[playerid][pKills]);
        
strcat(stringtmp);
               
format(tmpsizeof(tmp), "Total Deaths: %d\n"pInfo[playerid][pDeaths]);
        
strcat(stringtmp);
               
format(tmpsizeof(tmp), "Moneybags Found: %0.2f\n"pInfo[playerid][pMoneyBags]);
        
strcat(stringtmp);
               
format(tmpsizeof(tmp), "Total Times Farted: %s\n"pInfo[playerid][pFarts]);
        
strcat(stringtmp);
                
format(tmpsizeof(tmp),, "Spontaneous Combustions: %s\n"pInfo[playerid][pFartExp]);
        
strcat(stringtmp);
                .... continue
                new 
name[128];
                
format(namesizeof(name), "{FF6666}Player Stats for %s"PlayerName);
        
ShowPlayerDialog(playeridSTATS_DIALOGDIALOG_STYLE_MSGBOXnamestring"Okay","");
     } 
continue what i was doin, hopefully it works, im still new to scripting ^_^
Reply
#9

thanks trucido, that worked.

thanks for all the help guys. rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)