[SOLVED] Problem with /stats [ID] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] Problem with /stats [ID] (
/showthread.php?tid=151885)
[SOLVED] Problem with /stats [ID] -
Flashy - 01.06.2010
Little problem again. I dunno how to fix the problem that I only can see my stats. I want to see the stats from other players.
I also donґt know how to add that I must use /stats [ID] when I type something wrong.
Код:
dcmd_stats(playerid, params[])
{
new pName[24], PlayerFile[50], str[128], pDeaths[50], pKills[50], pMoney[50];
GetPlayerName(playerid, pName, sizeof(pName));
format(PlayerFile, sizeof(PlayerFile), "/users/%s.ini", pName);
if(!dini_Exists(PlayerFile)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You aren't registered! Use /register to create an account.");
if(dini_Exists(PlayerFile))
{
pDeaths[24] = dini_Int(PlayerFile, "Deaths");
pKills[24] = dini_Int(PlayerFile, "Kills");
pMoney[24] = dini_Int(PlayerFile, "Money");
new Float:Ratio=floatdiv(pKills[24], pDeaths[24]);
format(str, sizeof(str), " ||%sґs Statistics ||", pName);
SendClientMessage(playerid, COLOR_WHITE, str);
format(str, sizeof(str), "(Money): Money: %d", pMoney[24]);
SendClientMessage(playerid, COLOR_WHITE, str);
format(str, sizeof(str), "(Stats): Kills: %d || Deaths: %d || Ratio: %.2f || Money: %d", pKills[24], pDeaths[24], Ratio, pMoney[24]);
SendClientMessage(playerid, COLOR_WHITE, str);
if(PlayerInfo[playerid][AdminLevel] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You are a player on the server.");
}
if(PlayerInfo[playerid][AdminLevel] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You are a Administrator Level 1 on the server.");
}
if(PlayerInfo[playerid][AdminLevel] == 2)
{
SendClientMessage(playerid, COLOR_WHITE, "You are an Administrator Level 2 on the server.");
}
if(PlayerInfo[playerid][AdminLevel] == 3)
{
SendClientMessage(playerid, COLOR_WHITE, "You are a Administrator Level 3 on the server.");
}
}
#pragma unused params
return 1;
}
Well, it seems easy I know. I only canґt find it. Maybe I am to tired
Re: Problem with /stats [ID] -
DJDhan - 01.06.2010
Код:
dcmd_stats(playerid, params[])
{
new pName[24], PlayerFile[50], str[128], pDeaths[50], pKills[50], pMoney[50],targetid;
if(!strlen(params)) targetid = playerid;
else targetid = strval(params);
GetPlayerName(targetid, pName, sizeof(pName));
format(PlayerFile, sizeof(PlayerFile), "/users/%s.ini", pName);
if(!dini_Exists(PlayerFile)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You aren't registered! Use /register to create an account.");
if(dini_Exists(PlayerFile))
{
pDeaths[24] = dini_Int(PlayerFile, "Deaths");
pKills[24] = dini_Int(PlayerFile, "Kills");
pMoney[24] = dini_Int(PlayerFile, "Money");
new Float:Ratio=floatdiv(pKills[24], pDeaths[24]);
format(str, sizeof(str), " ||%sґs Statistics ||", pName);
SendClientMessage(playerid, COLOR_WHITE, str);
format(str, sizeof(str), "(Money): Money: %d", pMoney[24]);
SendClientMessage(playerid, COLOR_WHITE, str);
format(str, sizeof(str), "(Stats): Kills: %d || Deaths: %d || Ratio: %.2f || Money: %d", pKills[24], pDeaths[24], Ratio, pMoney[24]);
SendClientMessage(playerid, COLOR_WHITE, str);
if(PlayerInfo[targetid][AdminLevel] == 0)
{
if(targetid==playerid)
{SendClientMessage(playerid, COLOR_WHITE, "You are a player on the server.");
}
else SendClientMessage(playerid,0xffffffaa,"This player is a player on the server");
}
if(PlayerInfo[tagetid][AdminLevel] == 1)
{
if(targetid==playerid)
{SendClientMessage(playerid, COLOR_WHITE, "You are an Administrator Level 1 on the server.");
}
else SenClientMessage(playerid,0xffffffaa,"This player is an Administrator Level 1 on the server");
}
if(PlayerInfo[targetid][AdminLevel] == 2)
{
if(targetid==playerid)
{SendClientMessage(playerid, COLOR_WHITE, "You are an Administrator Level 2 on the server.");
}
else SenClientMessage(playerid,0xffffffaa,"This player is an Administrator Level 2 on the server");
}
if(PlayerInfo[targetid][AdminLevel] == 3)
{
if(targetid==playerid)
{SendClientMessage(playerid, COLOR_WHITE, "You are an Administrator Level 3 on the server.");
}
else SenClientMessage(playerid,0xffffffaa,"This player is an Administrator Level 3 on the server");
}
}
#pragma unused params
return 1;
}