08.10.2017, 11:02
PHP код:
YCMD:stats(playerid, params[], help) {
if(help) {
SendClientMessage(playerid, X11_WHITE, "Sends a player their game stats");
return 1;
}
SendStats(playerid,playerid);
return 1;
}
PHP код:
SendStats(playerid,targetid) {
new msg[508];
query[0] = 0;
new name[250];
if(GetPVarInt(targetid, "DonateRank") < 1)
{
format(name,sizeof(name)," {FF0000}%s",GetPlayerNameEx(targetid,ENameType_CharName));
}
if(GetPVarInt(targetid, "DonateRank") > 0 && GetPVarInt(playerid, "DonateRank") < 4)
{
format(name,sizeof(name)," {FFFF00}%s",GetPlayerNameEx(targetid,ENameType_CharName));
}
if(GetPVarInt(targetid, "DonateRank") == 4)
{
format(name,sizeof(name)," {FF33FF}%s",GetPlayerNameEx(targetid,ENameType_CharName));
}
SendClientMessage(playerid, COLOR_WHITE, msg);
new spousename[MAX_PLAYER_NAME+1];
GetPVarString(targetid, "SpouseName", spousename, sizeof(spousename));
SendClientMessage(playerid, COLOR_DARKGREEN, "|__________________[ %s ]__________________|",GetPlayerNameEx(playerid, ENameType_RPName));
format(msg,sizeof(msg),"EXPERIENCE: Level:[%s] Sex:[%s] Cash:[$%s] Bank:[$%s] Spouse:[%s]\n",getNumberString(GetPVarInt(targetid,"Level")),GetSexName(GetPVarInt(targetid,"Sex")),getNumberString(GetPVarInt(targetid,"Money")),getNumberString(GetPVarInt(targetid,"Bank")),spousename);
SendClientMessage(playerid, COLOR_GRAD1, msg);
// strcat(query, msg, sizeof(query));
if(GetPVarInt(targetid, "DonateRank") < 1)
{
format(msg,sizeof(msg),"CHARACTER: Phone Number:[%d] Lotto Number:[%d] Job:[%s]\n",GetPVarInt(targetid,"PhoneNumber"),getPlayerLottoTicket(targetid),GetJobName(GetPVarInt(targetid,"Job")));
}
if(GetPVarInt(targetid, "DonateRank") > 0 && GetPVarInt(playerid, "DonateRank") < 4)
{
format(msg,sizeof(msg),"CHARACTER: DonateRank:[{FFFF00}%s{FFFFFF}] Donate Points:[{FFFF00}%s{FFFFFF}] Phone Number:[%d] Lotto Number:[%d] Job:[%s] Fight Style:[%s]\n",GetDonateRank(GetPVarInt(targetid,"DonateRank")),getNumberString(GetPVarInt(targetid,"DonatePoints")),GetPVarInt(targetid,"PhoneNumber"),getPlayerLottoTicket(targetid),GetJobName(GetPVarInt(targetid,"Job")),GetFightStyle(GetPVarInt(targetid, "FightStyle")));
}
if(GetPVarInt(targetid, "DonateRank") == 4)
{
format(msg,sizeof(msg),"CHARACTER: Phone Number:[%d] Lotto Number:[%d] Job:[%s]\n",GetPVarInt(targetid,"PhoneNumber"),getPlayerLottoTicket(targetid),GetJobName(GetPVarInt(targetid,"Job")));
}
SendClientMessage(playerid, COLOR_GRAD2, msg);
///strcat(query, msg, sizeof(query));
format(msg,sizeof(msg),"CHARACTER: Wanted Level:[%d] Times Arrested:[%s]\n",GetPlayerWantedLevel(playerid),getNumberString(GetPVarInt(targetid,"TimesArrested")));
SendClientMessage(playerid, COLOR_GRAD1, msg);
// strcat(query, msg, sizeof(query));
new nextlevel = (GetPVarInt(targetid,"Level")+1);
new nextlevelcost = nextlevel*levelcost;
new expamount = nextlevel*levelexp;
format(msg,sizeof(msg),"OTHER: Respect:[%s/%s] SpecialItem:[%s] Hunger:[%d]\n",getNumberString(GetPVarInt(targetid,"RespectPoints")),getNumberString(expamount),GetPlayerCarryingItemName(targetid),GetHungerLevel(targetid));
SendClientMessage(playerid, COLOR_GRAD2, msg);
// strcat(query, msg, sizeof(query));
format(msg,sizeof(msg),"INVENTORY: Cigars:[%s] LockPicks:[%s] Furniture Tokens:[%d] Walkie Talkie Channel:[%d]\n",getNumberString(GetPVarInt(targetid, "Cigars")),getNumberString(GetPVarInt(targetid, "VehLockpicks")),GetPVarInt(targetid, "FurnitureTokens"),GetPVarInt(targetid, "WTChannel"));
SendClientMessage(playerid, COLOR_GRAD1, msg);
//strcat(query, msg, sizeof(query));
format(msg,sizeof(msg),"INVENTORY: Pot:[%s Gram] Coke:[%s Gram] Meth:[%s Gram]\n",getNumberString(GetPVarInt(targetid, "Pot")),getNumberString(GetPVarInt(targetid, "Coke")),getNumberString(GetPVarInt(targetid, "Meth")));
SendClientMessage(playerid, COLOR_GRAD2, msg);
// strcat(query, msg, sizeof(query));
format(msg,sizeof(msg),"INVENTORY: Materials Type A:[%s Packs] Materials Type B:[%s Packs] Materials Type C:[%s Packs]\n",getNumberString(GetPVarInt(targetid, "MatsA")),getNumberString(GetPVarInt(targetid, "MatsB")),getNumberString(GetPVarInt(targetid, "MatsC")));
SendClientMessage(playerid, COLOR_LIGHTRED, msg);
// strcat(query, msg, sizeof(query));
new fid = GetPVarInt(targetid,"Family");
if(fid != 0) {
fid = FindFamilyBySQLID(fid);
} else fid = -1;
if(fid == -1 && GetPVarInt(targetid, "Faction") != 0) {
fid = GetPVarInt(targetid, "Faction");
format(msg,sizeof(msg),"CHARACTER: Faction:[%s] Rank:[%s]\n",GetFactionName(fid),getFactionRankName(fid,GetPVarInt(targetid, "Rank")));
SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
// strcat(query, msg, sizeof(query));
} else if(fid != -1) {
format(msg,sizeof(msg),"CHARACTER: Family:[%s] Rank:[%s]\n",GetFamilyName(fid),getRankName(fid,GetPVarInt(targetid, "Rank")));
SendClientMessage(playerid, COLOR_LIGHTRED, msg);
// strcat(query, msg, sizeof(query));
}
format(msg,sizeof(msg),"CHARACTER: Time Played:[%s] Helper Team Rank:[%s] RP Tokens:[%s]\n",getNumberString(GetPVarInt(targetid,"ConnectTime")),GetNewbieName(targetid),getNumberString(GetPVarInt(targetid,"Cookies")));
SendClientMessage(playerid, COLOR_GRAD1, msg);
//strcat(query, msg, sizeof(query));
new matpacks[3], drugpacks[3];
matpacks[0] = GetPVarInt(playerid, "MatAPacks");
matpacks[1] = GetPVarInt(playerid, "MatBPacks");
matpacks[2] = GetPVarInt(playerid, "MatCPacks");
drugpacks[0] = GetPVarInt(playerid, "PotSeeds");
drugpacks[1] = GetPVarInt(playerid, "CokePlants");
drugpacks[2] = GetPVarInt(playerid, "MethMaterials");
if(matpacks[0] != 0 || matpacks[1] != 0 || matpacks[2] != 0) {
format(msg,sizeof(msg),"INVENTORY: MatAPacks:[%s] MatBPacks:[%s] MatCPacks:[%s]\n",getNumberString(matpacks[0]),getNumberString(matpacks[1]),getNumberString(matpacks[2]));
SendClientMessage(playerid, COLOR_LIGHTRED, msg);
//strcat(query, msg, sizeof(query));
}
if(drugpacks[0] != 0 || drugpacks[1] != 0 || drugpacks[2] != 0) {
format(msg,sizeof(msg),"INVENTORY: PotSeeds:[%s] CokePlants:[%s] MethMaterials:[%s]\n",getNumberString(drugpacks[0]),getNumberString(drugpacks[1]),getNumberString(drugpacks[2]));
SendClientMessage(playerid, COLOR_LIGHTRED, msg);
//strcat(query, msg, sizeof(query));
}
new jailtime = GetPVarInt(targetid, "ReleaseTime");
new isajail;
if(jailtime == 0) {
jailtime = GetPVarInt(targetid, "AJailReleaseTime");
isajail = 1;
}
jailtime -= gettime();
if(jailtime > 0) {
format(msg, sizeof(msg), "{FFFFFF}Jail Time Left: %s sec\n", getNumberString(jailtime));
SendClientMessage(playerid, isajail?COLOR_LIGHTRED:COLOR_WHITE, msg);
//strcat(query, msg, sizeof(query));
}
if(EAdminFlags:GetPVarInt(playerid, "AdminFlags") != EAdminFlags_None) {
format(msg, sizeof(msg), "OTHER: NumAJails:[%s] NumKicks:[%s] NumBans[%s] Wealth:[%s]\n",getNumberString(GetPVarInt(targetid, "NumAJAils")),getNumberString(GetPVarInt(targetid, "NumKicks")), getNumberString(GetPVarInt(targetid, "NumBans")),getNumberString(getTotalWealth(targetid)));
SendClientMessage(playerid, COLOR_LIGHTRED, msg);
//strcat(query, msg, sizeof(query));
}
//ShowPlayerDialog(playerid, ERP_ViewStats, DIALOG_STYLE_MSGBOX, name,query,"Close", "");
SendClientMessage(playerid, COLOR_DARKGREEN, "|__________________[ %s ]__________________|", GetPlayerNameEx(playerid, ENameType_RPName));
}