15.05.2013, 13:44
Oke I will give you a example with zcmd and sscanf, if you don't want to use this you should compile this to strcmp yourself. assuming that you saved these statics somewhere and can call it with your enum pInfo I would say this must work for you:
I hope this helped you I didnt tested it! If this is not working please contact me or find our what is wrong
Kind regarts, Jordy
pawn Код:
#define DIALOG_USERSTATS 1234
//^ this is the dialog id for the userstatics, place this on top of your script under de includes
COMMAND:stats(playerid, params[]) {//defining the command that must be entered to control this dialog.
new targetid;//this is needed to check the targetid's stats in the sscanf switch.
if(!sscanf(params, "U(-1)", targetid)) {//this is giving a optinal paramater (the targetid), when the command is called without a targetid it will show your stats.
//this is the playerid dialog
new string[2000];//now we are making a new string to show up in the dialog
strcat(string, "KIlls: %d\n", PlayerInfo[playerid][pKills]);//this is formating your string
strcat(string, "Deaths: %d\n", PlayerInfo[playerid][pDeaths]);
strcat(string, "Money: %d\n", PlayerInfo[playerid][pCash]);//copy this with whatever you want to show in the dialog
ShowPlayerDialog(playerid, DIALOG_USERSTATS, DIALOG_STYLE_MSGBOX, "Your statics", string, "OK", "");
} else {
//this is the targetid dialog
new string[2000];//now we are making a new string to show up in the dialog
strcat(string, "KIlls: %d\n", PlayerInfo[targetid][pKills]);//this is formating your string
strcat(string, "Deaths: %d\n", PlayerInfo[targetid][pDeaths]);
strcat(string, "Money: %d\n", PlayerInfo[targetid][pCash]);//copy this with whatever you want to show in the dialog
ShowPlayerDialog(playerid, DIALOG_USERSTATS, DIALOG_STYLE_MSGBOX, "Target statics", string, "OK", "");
}
return 1;
}
Kind regarts, Jordy