stats command
#1

Hello guys, I've made this:
Код:
CMD:stats(playerid, params[])
{
    new money = PlayerInfo[playerid][Money];
    new deaths = PlayerInfo[playerid][Deaths];
    new kills = PlayerInfo[playerid][Kills];
    new score = PlayerInfo[playerid][Score];
    new admin = PlayerInfo[playerid][AdminLevel];
    new string[500];
    format(string,sizeof(string),"[General] - [Money: %d] | [Deaths: %d] | [Kills: %d] | [Score: %d] | [Admin Level: %d]",money,deaths,kills,score,admin);
    SendClientMessage(playerid, COLOR_GREEN, string);
    return 1;
}
And it just shows the stats with values of 0 0 0 0 0 even after i /kill, and edit the userfile, what's wrong?
Reply
#2

You're possibly not loading the user's data to the array.
Reply
#3

You don't need to assign a variable to them if they're just integer values, you could try just putting the variables directly into the format line. Also, the string variable shouldn't be 500, 128 should be fine if not 256. If it doesn't work, then it's probably something to do with how stats are saved.
Reply
#4

try this

Код HTML:
CMD:stats(playerid, params[])
{
    new string[500];
    format(string,sizeof(string),"[General] - [Money: %d] | [Deaths: %d] | [Kills: %d] | [Score: %d] | [Admin Level: %d]",PlayerInfo[playerid][Money],PlayerInfo[playerid][Deaths],PlayerInfo[playerid][Kills],PlayerInfo[playerid][Score],PlayerInfo[playerid][AdminLevel]);
    SendClientMessage(playerid, COLOR_GREEN, string);
    return 1;
}
Reply
#5

Quote:
Originally Posted by StR_MaRy
Посмотреть сообщение
try this

Код HTML:
CMD:stats(playerid, params[])
{
    new string[500];
    format(string,sizeof(string),"[General] - [Money: %d] | [Deaths: %d] | [Kills: %d] | [Score: %d] | [Admin Level: %d]",PlayerInfo[playerid][Money],PlayerInfo[playerid][Deaths],PlayerInfo[playerid][Kills],PlayerInfo[playerid][Score],PlayerInfo[playerid][AdminLevel]);
    SendClientMessage(playerid, COLOR_GREEN, string);
    return 1;
}
Same thing, here is my code, maybe something is wrong with it?
Код:
enum E_PLAYER_DATA
{
	Password[129],
    AdminLevel,
    VIPLevel,
    Money,
    Score,
    Kills,
    Deaths,
    bool:LoggedIn
};
new PlayerInfo[MAX_PLAYERS][E_PLAYER_DATA];




INI_SetTag(file, "PlayerData");
           	INI_WriteString(file, "Password", PlayerInfo[playerid][Password]);
           	INI_WriteInt(file, "AdminLevel", 0);
           	INI_WriteInt(file, "VIPLevel", 0);
           	INI_WriteInt(file, "Money", 0);
           	INI_WriteInt(file, "Score", 0);
           	INI_WriteInt(file, "Kills", 0);
           	INI_WriteInt(file, "Deaths", 0);
           	INI_Close(file);
Here is how it looks:


thanks
Reply
#6

You need to have the ini file open before you can start changing it, there's a function called INI_Open I believe that opens up a .ini file.
Reply
#7

you have somewhere a file or a database where all this things save?
Reply
#8

Quote:
Originally Posted by StR_MaRy
Посмотреть сообщение
you have somewhere a file or a database where all this things save?
You mean a path?
Код:
#define USER_PATH "/Users/%s.ini"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)