Health+Armour saving as 1.
#1

I have(in the database and ingame) set them to floats, though when a player leaves, it says it as 1 rather than 100. When I save the account:
pawn Код:
UPDATE `accounts` SET `Health` = %f, `Armour` = %f
pawn Код:
Float: Health,
    Float: Armour,
So they are floats.
Reply
#2

Can you show where it loads from the database?
Reply
#3

Check the Armor / Health Row length in the database
Reply
#4

Quote:
Originally Posted by d3ll
Посмотреть сообщение
Can you show where it loads from the database?
Sure.
pawn Код:
PlayerInfo[playerid][Health] = cache_get_row_float(0, 3, MySQLConnection);
    PlayerInfo[playerid][Armour] = cache_get_row_float(0, 4, MySQLConnection);
Quote:
Originally Posted by Golimad
Посмотреть сообщение
Check the Armor / Health Row length in the database
They're set to 5.
Reply
#5

Make sure you are saving it like this:

pawn Код:
GetPlayerHealth(playerid, PlayerInfo[playerid][Health]);
GetPlayerArmour(playerid, PlayerInfo[playerid][Armour]);
GetPlayerHealth and GetPlayerArmour return 1 if the player is connected and the function has ran successfully. It doesn't return the health or armor directly, you have to pass it by reference.
Reply
#6

Yeah, thanks. Seems to have sorted it. Sadly, the anticheat keeps saying I'm hacking, I don't know if it's due to the fact that it's like 100.000000. What's the best way to round it down to just 100? or 56? Rather than having .000 after it?
Reply
#7

pawn Код:
mysql_format(MySQL, query, sizeof(query), "UPDATE `accounts` SET `Health' = '%0.0f', `Armour` = '%0.0f' WHERE `PlayerName` = '%s'");
Changes:

100.0000000 > 100
Reply
#8

Oh, you do learn something new every day. Thanks!

And I love you too<3

EDIT:

For some reason, it still detects it as hacking. Here's the code.
pawn Код:
if(PlayerInfo[playerid][Cash] != GetPlayerMoney(playerid))
        {
            format(GlobalString, sizeof(GlobalString), "%s "COL_WHITE"could potentially be Money hacking.(/check)", GetUsername(playerid));
            SendMessageToAdmins(COLOR_REALRED, GlobalString);
        }
        if(PlayerInfo[playerid][Health] != GetPlayerHealth(playerid, h))
        {
            format(GlobalString, sizeof(GlobalString), "%s "COL_WHITE"could potentially be Health hacking.(/check)", GetUsername(playerid));
            SendMessageToAdmins(COLOR_REALRED, GlobalString);
        }
        if(PlayerInfo[playerid][Armour] != GetPlayerArmour(playerid, a))
        {
            format(GlobalString, sizeof(GlobalString), "%s "COL_WHITE"could potentially be Armour hacking.(/check)", GetUsername(playerid));
            SendMessageToAdmins(COLOR_REALRED, GlobalString);
        }
Reply
#9

Use floatround function, show your lines with saving health and armor and I'll help you to change it.
Reply
#10

pawn Код:
floatround(PlayerInfo[playerid][Health]),floatround(PlayerInfo[playerid][Armour])
I've done it. But I'm still having issues with the anticheat. Keeps detecting it as a hack.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)