14.05.2013, 22:42
i need some help am trying to find out how to make player stats etc but there is not a single tut on how to make it can soemone please help me with it.
Something like this but obvis i cant use this as its not on my script. public ShowStats(playerid,targetid) { if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid)) { new cash = GetPlayerMoney(targetid); new atext[20]; if(PlayerInfo[targetid][pSex] == 1) { atext = "Male"; } else if(PlayerInfo[targetid][pSex] == 2) { atext = "Female"; } new otext[20]; if(PlayerInfo[targetid][pPlace] == 1) { otext = "Europe"; } else if(PlayerInfo[targetid][pPlace] == 2) { otext = "America"; } new drank[20]; if(PlayerInfo[targetid][pVip] == 1) { drank = "Gold Donator"; } else if(PlayerInfo[targetid][pVip] == 2) { drank = "Silver Donator"; } else { drank = "None"; } new age = PlayerInfo[targetid][pAge]; new warns = PlayerInfo[targetid][pWarns]; new level = PlayerInfo[targetid][pLevel]; new exp = PlayerInfo[targetid][pExp]; new nxtlevel = PlayerInfo[targetid][pLevel]+1; new expamount = nxtlevel*levelexp; new costlevel = nxtlevel*levelcost; new name[MAX_PLAYER_NAME]; new pnumber = PlayerInfo[targetid][pNumber]; GetPlayerName(targetid, name, sizeof(name)); new Float:px,Float:py,Float:pz; GetPlayerPos(targetid, px, py, pz); new coordsstring[128]; SendClientMessage(playerid, COLOR_GREEN,"_____________________________________________________________________________________________"); format(coordsstring, sizeof(coordsstring),"*** %s ***",name); SendClientMessage(playerid, COLOR_YELLOW,coordsstring); format(coordsstring, sizeof(coordsstring), "Level:[%d] Sex:[%s] Age:[%d] Origin:[%s] Cash:[$%d] Phone:[%d] ", level,atext,age,otext, cash, pnumber); SendClientMessage(playerid, COLOR_WHITE,coordsstring); format(coordsstring, sizeof(coordsstring), "DonateRank:[%s] Warns:[%d/5]", drank, warns); SendClientMessage(playerid, COLOR_LIGHTBLUE,coordsstring); format(coordsstring, sizeof(coordsstring), "NextLevel:[$%d] Respect:[%d/%d]",costlevel,exp,expamount); SendClientMessage(playerid, COLOR_LIGHTBLUE,coordsstring); SendClientMessage(playerid, COLOR_GREEN,"____________________________________________________________________________________________"); } }
enum pInfo { pPass, pCash, pAdmin, pWarns, pKills, pDeaths, TutKick, AdminLevel, pMuted, pMuteTime, pLevel, pLocked, pTester, pModel, } new PlayerInfo[MAX_PLAYERS][pInfo];
#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;
}