Assign a value to the variable
#1

Hello everyone. I just watch a tutorial with register / login (Y_INI) and everything works fine, but i have a question and i can't get the answer.

I made pLevel into the enum, in INI_WriteInt, etc, but how i assign the value from GetPlayerScore in pLevel?

I have a stats command who looks like this:
Код:
CMD:stats(playerid,params[])
{
    if(IsPlayerConnected(playerid))
        {
            new Cash = PlayerInfo[playerid][pCash];
            new Admin = PlayerInfo[playerid][pAdmin];
            new Kills = PlayerInfo[playerid][pKills];
            new Deaths = PlayerInfo[playerid][pDeaths];
	    new Level = PlayerInfo[playerid][pLevel];
            new string1[128],stats[1024];
            format(string1, sizeof string1, "Bani: $%d | Crime: %i | Decesuri: %i | Admin: %i | Level: %i", Cash,Admin,Kills,Deaths);
            format(stats, sizeof stats, "%s", string1);
            SCM(playerid,-1,string1);
        }
	return 1;
}
Thank you!
Reply
#2

This might work if what I understand from your words are what you need.

Код:
CMD:stats(playerid,params[])
{
    if(IsPlayerConnected(playerid))
        {
            PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid) 
            new Cash = PlayerInfo[playerid][pCash];
            new Admin = PlayerInfo[playerid][pAdmin];
            new Kills = PlayerInfo[playerid][pKills];
            new Deaths = PlayerInfo[playerid][pDeaths];
	    new Level = PlayerInfo[playerid][pLevel];
            new string1[128],stats[1024];
            format(string1, sizeof string1, "Bani: $%d | Crime: %i | Decesuri: %i | Admin: %i | Level: %i", Cash,Admin,Kills,Deaths,Level);
            format(stats, sizeof stats, "%s", string1);
            SCM(playerid,-1,string1);
        }
	return 1;
}
Reply
#3

Quote:
Originally Posted by Rongvaldyr
Посмотреть сообщение
This might work if what I understand from your words are what you need.

Код:
CMD:stats(playerid,params[])
{
    if(IsPlayerConnected(playerid))
        {
            PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid) 
            new Cash = PlayerInfo[playerid][pCash];
            new Admin = PlayerInfo[playerid][pAdmin];
            new Kills = PlayerInfo[playerid][pKills];
            new Deaths = PlayerInfo[playerid][pDeaths];
	    new Level = PlayerInfo[playerid][pLevel];
            new string1[128],stats[1024];
            format(string1, sizeof string1, "Bani: $%d | Crime: %i | Decesuri: %i | Admin: %i | Level: %i", Cash,Admin,Kills,Deaths,Level);
            format(stats, sizeof stats, "%s", string1);
            SCM(playerid,-1,string1);
        }
	return 1;
}
Thank you! It works! Another problem: The money from user account (scriptfiles ) it gets updated in stats command after some restarts. I want to update that after some minutes, do you know how i do that?
Reply
#4

For that, you might try this; but your format looks weird, check if your stats are correct for character

Код:
CMD:stats(playerid,params[])
{
    if(IsPlayerConnected(playerid))
        {
            PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid)
            PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid) 
            new Cash = PlayerInfo[playerid][pCash];
            new Admin = PlayerInfo[playerid][pAdmin];
            new Kills = PlayerInfo[playerid][pKills];
            new Deaths = PlayerInfo[playerid][pDeaths];
	    new Level = PlayerInfo[playerid][pLevel];
            new string1[128],stats[1024];
            format(string1, sizeof string1, "Bani: $%d | Crime: %i | Decesuri: %i | Admin: %i | Level: %i", Cash,Admin,Kills,Deaths,Level);
            format(stats, sizeof stats, "%s", string1);
            SCM(playerid,-1,string1);
        }
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)