26.05.2015, 01:06
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.
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(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;
}