Two problems.
#1

1.
Okay. Why I am getting on next log in if player logged out with 100 HP?
Код:
This is taken from players info file .ini, after logging off with 100hp.

Health=1.000000
Armour=1.000000
Here is code how I save it.

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new Float: health;
    new Float: armour;
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdmin]);
        dini_FloatSet(file, "Health",GetPlayerHealth(playerid, health));
        dini_FloatSet(file, "Armour",GetPlayerArmour(playerid, armour));
        dini_IntSet(file, "Cash",GetPlayerMoney(playerid));
        dini_IntSet(file, "Level",GetPlayerScore(playerid));
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}


2.
Whats wrong with this command? Command just doesn't work.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext,"/heal",true))
    {
        new pID, health;
        if(PlayerInfo[playerid][pAdmin] >= 0)
        if(!sscanf(cmdtext, "ui", pID, health))
        {
            SetPlayerHealth(pID, health);
            SendClientMessage(playerid, -1, "You have successfully set players health!");
        }
        else return SendClientMessage(playerid, -1, "Usage: /heal [PlayerID][Amount]");
        return 1;
    }
    return 1;
}
Reply
#2

1. Are the other variables saving properly?

2. I doubt you can use sscanf with strcmp like you are using it.
Reply
#3

1. Other variables saves properly.

2. Hmm, all right. What should I use then? If I want use strcmp and something other in same time?
Reply
#4

I found solution...

Quote:
Originally Posted by xir
Посмотреть сообщение
Try this, put under onpalyerdisconnect

pawn Код:
new Float:Health;
    GetPlayerHealth(playerid, Health);
    dini_FloatSet(file, "Health", floatround(Health));
Reply
#5

1. That's not the usage of GetPlayerHealth an GetPlayerArmour
Reply
#6

Command:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext,"/heal",true,5))
    {
        new pID, health;
        if(PlayerInfo[playerid][pAdmin] <= 0)  return SendClientMessage(playerid, -1, "ERROR: You are not Admin Level 1 or higher.");
        if(!sscanf(cmdtext, "ui", pID, health))
        {
            SetPlayerHealth(pID, health);
            SendClientMessage(playerid, -1, "You have successfully set players health!");
        }
        else return SendClientMessage(playerid, -1, "Usage: /heal [PlayerID][Amount]");
        return 1;
    }
    return 1;
}
Should work then.
Reply
#7

Thanks for help. Everything has been fixed and now works well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)