STATS command. -
Bug. - 27.10.2012
How to creat stats command?
My Register system -
https://sampforum.blast.hk/showthread.php?tid=273088
Код:
if (strcmp("/stats", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, 0xFFFFFFFF, " |- - - - - - - - - - - - - - - - - - - |");
SendClientMessage(playerid, 0xFFFFFFFF, " - [Player name] these are your stats");
SendClientMessage(playerid, 0xFFFFFFFF, " - Cash: ");
SendClientMessage(playerid, 0xFFFFFFFF, " - Kills:");
SendClientMessage(playerid, 0xFFFFFFFF, " - Deaths:");
SendClientMessage(playerid, 0xFFFFFFFF, " - Admin Level:");
SendClientMessage(playerid, 0xFFFFFFFF, " |- - - - - - - - - - - - - - - - - - - |");
return 1;
}
Код:
new gPlayerLogged[MAX_PLAYERS];
new pRank[MAX_PLAYERS];
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
return 1;
}
Re: STATS command. -
gtakillerIV - 27.10.2012
Here:
PHP код:
if (strcmp("/stats", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, 0xFFFFFFFF, " |- - - - - - - - - - - - - - - - - - - |");
new string[128];
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname,sizeof(aname));
format(string,sizeof(string), "%s These are your stats:", aname);
SendClientMessage(playerid, 0xFFFFFFFF,string);
format(string,sizeof(string), "- Cash: %i", GetPlayerMoney(playerid));
SendClientMessage(playerid, 0xFFFFFFFF, string);
format(string,sizeof(string), "- Kills: %i", PlayerInfo[playerid][pKills]);
SendClientMessage(playerid, 0xFFFFFFFF, string);
format(string,sizeof(string), "- Deaths: %i", PlayerInfo[playerid][pDeaths]);
SendClientMessage(playerid, 0xFFFFFFFF, string);
format(string,sizeof(string), "- Admin Level: %i", PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, 0xFFFFFFFF, string);
SendClientMessage(playerid, 0xFFFFFFFF, " |- - - - - - - - - - - - - - - - - - - |");
return 1;
}
Re: STATS command. -
Bug. - 27.10.2012
Thanks +REP
Re: STATS command. -
Bug. - 27.10.2012
Can someone help me, When i connect is send to all:
format(string,sizeof string,"SERVER: %s has joined the server.",pName);
and it'll send me my kills and deaths
Код:
public OnPlayerConnect(playerid)
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"SERVER: %s has joined the server.",pName);
SendClientMessageToAll(0xFFFFFFAA,string);
format(string,sizeof string,"SERVER: IP: ",pName);
format(string,sizeof string,"SERVER: Kills: x || Deaths: x ",pName);
SendClientMessage(0xFFFFFFAA,string);
return 1;
}
Like this:
SERVER: [Playername] has joined the server. - SendClientMessageToall
SERVER: IP: xxx.xxx.xxx. - SendClientMessage
SERVER: Kills: x || Deaths: x. - SendClientMessage
Re: STATS command. -
gtakillerIV - 27.10.2012
PHP код:
format(string,sizeof string,"SERVER: Kills: x || Deaths: x ",pName);
Should be:
PHP код:
format(string,sizeof(string),"SERVER: Kills: %i || Deaths: %i ",PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
This:
PHP код:
format(string,sizeof string,"SERVER: IP: ",pName);
Should be:
PHP код:
new IP;
GetPlayerIp(playerid, IP, sizeof(IP));
format(string,sizeof string,"SERVER: IP: ",IP);
Read this if you want:
http://forum.sa-mp.com/showthread.ph...55#post2190855
Re: STATS command. -
Bug. - 27.10.2012
What about the IP?
Re: STATS command. -
gtakillerIV - 27.10.2012
Yes I noticed some can I say milliseconds ago

Re-read it please.
Re: STATS command. -
Bug. - 27.10.2012
i have errors
Код:
:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(484) : error 035: argument type mismatch (argument 2)
I:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(484) : error 035: argument type mismatch (argument 2)
I:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(486) : error 001: expected token: ";", but found "-identifier-"
I:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(487) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Код:
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"SERVER: %s has joined the server.",pName);
SendClientMessageToAll(0xFFFFFFAA,string);
new IP;
GetPlayerIp(playerid, IP, sizeof(IP));
format(string,sizeof string,"SERVER: IP: ",IP);
format(string,sizeof(string),"SERVER: Kills: %i || Deaths: %i ",PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
SendClientMessage(0xFFFFFFAA,string);
Re: STATS command. -
CmZxC - 27.10.2012
you still didnt change it
must be
pawn Код:
format(string,sizeof string,"SERVER: IP: %s",IP); // with %s
give us lines that gave you errors
EDIT:IP must be a string, new IP[32];
Re: STATS command. -
Bug. - 27.10.2012
i change it!
Код:
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"SERVER: %s has joined the server.",pName);
SendClientMessageToAll(0xFFFFFFAA,string);
new IP;
GetPlayerIp(playerid, IP, sizeof(IP));
format(string,sizeof string,"SERVER: IP: %s",IP);
format(string,sizeof(string),"SERVER: Kills: %i || Deaths: %i ",PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
SendClientMessage(0xFFFFFFAA,string);
Код:
I:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(484) : error 035: argument type mismatch (argument 2)
I:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(484) : error 035: argument type mismatch (argument 2)
I:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(487) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.