05.02.2012, 22:30
I Have a problem with /stats command. All the other commands work fine but only the stats..
CMDtats
CMDtatistics
stock showStats
CMDtats
pawn Код:
CMD:stats(playerid, params[]) {
return cmd_statistics(playerid, params);
}
pawn Код:
CMD:statistics(playerid, params[]) {
return showStats(playerid,playerid);
}
pawn Код:
stock showStats(playerid, targetid) {
new
param1[32],
date[3],
param2[32],
param4[32],
param5[32],
param3[32]; // I'll add one or two more of these later, they'll be used to show things like sex (if sex = whatever, param1 = "Male";). And we can use them over and over again.
SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
getdate(date[0], date[1], date[2]);
if(playerVariables[targetid][pJob] == 0) { param1 = "Unemployed"; }
else { strcpy(param1, jobVariables[playerVariables[targetid][pJob]][jJobName], sizeof(param1)); } // dest, source, length format(param1, sizeof(param1),"%s",jobVariables[playerVariables[targetid][pJob]][jJobName]); }
switch(playerVariables[targetid][pGender]) { //{ param2 = "Male"; } else { param2 = "Female"; }
case 1: param2 = "Male";
case 2: param2 = "Female";
default: param2 = "Unknown";
}
if(playerVariables[targetid][pPhoneNumber] != -1) { format(param3,sizeof(param3),"%d",playerVariables[targetid][pPhoneNumber]); }
else { param3 = "None"; }
format(szMessage, sizeof(szMessage), "%s | Age: %d (born %d) | Gender: %s | Playing hours: %d | Phone number: %s | Job: %s", playerVariables[targetid][pNormalName], date[0]-playerVariables[targetid][pAge], playerVariables[targetid][pAge], param2, playerVariables[targetid][pPlayingHours], param3, param1, param4);
SendClientMessage(playerid, COLOR_WHITE, szMessage);
if(playerVariables[targetid][pGroup] < 1) {
param1 = "None";
param2 = "None";
}
else {
format(param1, sizeof(param1), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupName]);
switch(playerVariables[targetid][pGroupRank]) { // strcpy(dest, source, length);
case 1: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName1]);
case 2: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName2]);
case 3: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName3]);
case 4: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName4]);
case 5: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName5]);
case 6: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName6]);
}
}
if(playerVariables[targetid][pWalkieTalkie] == -1) param3 = "None";
else if(playerVariables[targetid][pWalkieTalkie] == 0) param3 = "Disabled";
else format(param3, sizeof(param3), "#%d khz", playerVariables[targetid][pWalkieTalkie]);
format(szMessage, sizeof(szMessage), "Group: %s | Rank: %s (%d) | Bank: $%d | Cash: $%d | Materials: %d | Radio: %s", param1, param2, playerVariables[targetid][pGroupRank], playerVariables[targetid][pBankMoney], playerVariables[targetid][pMoney], playerVariables[targetid][pMaterials], param3);
SendClientMessage(playerid, COLOR_WHITE, szMessage);
format(szMessage, sizeof(szMessage), "Rope: %d | Weapon skill: %d (%d weapons) | Tracking skill: %d (%d searches) | Arrests: %d | Crimes: %d | Credit: $%d", playerVariables[targetid][pRope], playerVariables[targetid][pJobSkill][0]/50, playerVariables[targetid][pJobSkill][0], playerVariables[targetid][pJobSkill][1]/50, playerVariables[targetid][pJobSkill][1], playerVariables[targetid][pArrests], playerVariables[targetid][pCrimes], playerVariables[targetid][pPhoneCredit] / 60);
SendClientMessage(playerid, COLOR_WHITE, szMessage);
if(playerVariables[playerid][pAdminLevel] >= 1) {
new
Float:HAFloats[2],
country[MAX_COUNTRY_NAME];
GetPlayerHealth(targetid,HAFloats[0]);
GetPlayerArmour(targetid,HAFloats[1]);
GetCountryName(playerVariables[targetid][pConnectionIP], country, sizeof(country));
if(playerVariables[targetid][pCarModel] >= 400) { format(param4, sizeof(param4), "%s (ID %d)", VehicleNames[playerVariables[targetid][pCarModel] - 400], playerVariables[targetid][pCarID]); }
else { param4 = "None"; }
if(playerVariables[targetid][pKopterModel] >= 400) { format(param5, sizeof(param5), "%s (ID %d)", VehicleNames[playerVariables[targetid][pKopterModel] - 400], playerVariables[targetid][pKopterID]); }
else { param5 = "None"; }
format(szMessage, sizeof(szMessage), "Auto: %s | Helikopter: %s", param4, param5);
SendClientMessage(playerid, COLOR_WHITE, szMessage);
if(playerVariables[targetid][pStatus] != 1) param1 = "Unauthenticated"; else param1 = "Authenticated";
format(szMessage, sizeof(szMessage), "Status: %s | Admin Level: %d | Interior: %d | VW: %d | House: %d | Business: %d", param1, playerVariables[targetid][pAdminLevel], playerVariables[targetid][pInterior], playerVariables[targetid][pVirtualWorld], getPlayerHouseID(targetid), getPlayerBusinessID(targetid));
SendClientMessage(playerid, COLOR_WHITE, szMessage);
switch(playerVariables[targetid][pPrisonID]) {
case 0: format(szMessage, sizeof(szMessage), "IP: %s | Country: %s | Admin Name: %s | Health: %.1f | Armour: %.1f", playerVariables[targetid][pConnectionIP], country, playerVariables[targetid][pAdminName], HAFloats[0], HAFloats[1]);
case 1: format(szMessage, sizeof(szMessage), "IP: %s | Country: %s | Admin Name: %s | Health: %.1f | Armour: %.1f | Admin Prison Time: %d", playerVariables[targetid][pConnectionIP], country, playerVariables[targetid][pAdminName], HAFloats[0], HAFloats[1], playerVariables[targetid][pPrisonTime]);
case 2: format(szMessage, sizeof(szMessage), "IP: %s | Country: %s | Admin Name: %s | Health: %.1f | Armour: %.1f | Admin Jail Time: %d", playerVariables[targetid][pConnectionIP], country, playerVariables[targetid][pAdminName], HAFloats[0], HAFloats[1], playerVariables[targetid][pPrisonTime]);
case 3: format(szMessage, sizeof(szMessage), "IP: %s | Country: %s | Admin Name: %s | Health: %.1f | Armour: %.1f | Jail Time: %d", playerVariables[targetid][pConnectionIP], country, playerVariables[targetid][pAdminName], HAFloats[0], HAFloats[1], playerVariables[targetid][pPrisonTime]);
}
SendClientMessage(playerid, COLOR_WHITE, szMessage);
}
SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
return 1;
}