STATS command.
#1

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;
}
Reply
#2

Here:

PHP код:
if (strcmp("/stats"cmdtexttrue5) == 0)
{
    
SendClientMessage(playerid0xFFFFFFFF" |- - - - - - - - - - - - - - - - - - - |");
    new 
string[128];
    new 
aname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridaname,sizeof(aname));
    
format(string,sizeof(string), "%s These are your stats:"aname);
     
SendClientMessage(playerid0xFFFFFFFF,string);
     
format(string,sizeof(string), "- Cash: %i"GetPlayerMoney(playerid));
      
SendClientMessage(playerid0xFFFFFFFFstring);
      
format(string,sizeof(string), "- Kills: %i"PlayerInfo[playerid][pKills]);
       
SendClientMessage(playerid0xFFFFFFFFstring);
       
format(string,sizeof(string), "- Deaths: %i"PlayerInfo[playerid][pDeaths]);
       
SendClientMessage(playerid0xFFFFFFFFstring);
       
format(string,sizeof(string), "- Admin Level: %i"PlayerInfo[playerid][pAdmin]);
    
SendClientMessage(playerid0xFFFFFFFFstring);
    
SendClientMessage(playerid0xFFFFFFFF" |- - - - - - - - - - - - - - - - - - - |");
    return 
1;

Reply
#3

Thanks +REP
Reply
#4

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
Reply
#5

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(playeridIPsizeof(IP));
format(string,sizeof string,"SERVER: IP: ",IP); 
Read this if you want:

http://forum.sa-mp.com/showthread.ph...55#post2190855
Reply
#6

What about the IP?
Reply
#7

Yes I noticed some can I say milliseconds ago Re-read it please.
Reply
#8

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);
Reply
#9

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];
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)