Server side problem
#1

I did a server side for SetPlayerHealth and look:
PHP код:
PUBLIC: SetPlayerHealthEx(playeridFloat:health)
{
    new 
Float:tmp_health health,Float:newhp;
    if (
tmp_health 0.0tmp_health 0.0;
    else if (
tmp_health 100.0tmp_health 100.0;
    
AntiCheatInfo[playerid][acHealth] = tmp_health;
    
SetPlayerHealth(playeridtmp_health);
    
GetPlayerHealth(playeridnewhp);
    
printf("GetPlayerHealth: %.01f\nAntiCheatHealth: %.01f\nHealth: %.01f"newhpAntiCheatInfo[playerid][acHealth], tmp_health);
    return 
1;

This is debug
PHP код:
GetPlayerHealth99.0
AntiCheatHealth
98.0
Health
98.0 
Where is the problem i don`t understand, i don`t found any bugs ....

PHP код:
PUBLIC: PlayerHealthLoss()
{
    new 
Float:oldhealthFloat:amount;
    foreach(
Playerx)
    {
        if(
PlayerInfo[x][pStatus] == 1)
        {
            
GetPlayerHealth(xoldhealth);
            
amount floatsub(oldhealth1.0);
            
SetPlayerHealthEx(xamount);
        }
    }
    return 
1;

This function is called per every minute
Reply
#2

PHP код:
PUBLIC: SetPlayerHealthEx(playerid,Float:health)
{
    new 
Float:newhp;
    if(
health 0.0)health 0.0;
    else if(
health 100.0)health 100.0;
    
AntiCheatInfo[playerid][acHealth] = health;
    
printf("AntiCheatHealth: %.01f",AntiCheatInfo[playerid][acHealth]);
    
SetPlayerHealth(playerid,health);
    
GetPlayerHealth(playerid,newhp);
    
printf("GetPlayerHealth: %.01f\nAntiCheatHealth: %.01f\nHealth: %.01f"newhpAntiCheatInfo[playerid][acHealth], tmp_health);
    return 
1;

What will print now?
Reply
#3

Quote:
Originally Posted by MarvinPWN
Посмотреть сообщение
PHP код:
PUBLIC: SetPlayerHealthEx(playerid,Float:health)
{
    new 
Float:newhp;
    if(
health 0.0)health 0.0;
    else if(
health 100.0)health 100.0;
    
AntiCheatInfo[playerid][acHealth] = health;
    
printf("AntiCheatHealth: %.01f",AntiCheatInfo[playerid][acHealth]);
    
SetPlayerHealth(playerid,health);
    
GetPlayerHealth(playerid,newhp);
    
printf("GetPlayerHealth: %.01f\nAntiCheatHealth: %.01f\nHealth: %.01f"newhpAntiCheatInfo[playerid][acHealth], tmp_health);
    return 
1;

What will print now?
PHP код:
[14:21:45AntiCheatHealth99.0
[14:21:45GetPlayerHealth100.0
AntiCheatHealth
99.0
Health
99.0 
Reply
#4

it is a delay or something like that ? On /stats show me correctly.
Reply
#5

Anti-Cheat
PHP код:
GetPlayerHealth(ihealth);
            if(
health AntiCheatInfo[i][acHealth])
            {
                
format(stringsizeof(string), "AdmCmd: %s has been kicked by AdmBot, reason: using cheats (health hack)",PlayerInfo[i][pUsername]);
                
KickWithMessage(iCOLOR_LIGHTREDstring);
                
printf("GetPlayerHealth: %.01f\nAntiCheatHealth: %.01f"healthAntiCheatInfo[i][acHealth]);
            } 
This repeat per every second and look to debug:
PHP код:
[15:17:16GetPlayerHealth100.0
AntiCheatHealth
99.0 
This is annoying
Reply
#6

Get functions do not work right after Set functions because the update must first be sent to the player.
Reply
#7

Problem solved, i did a function like on junkbuster synctime. I think is good .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)