SetPlayerHealth %f
#1

- error fixed -
Reply
#2

What line is the error at?
Reply
#3

Код:
if//code here
    {
    if//code here
        {
        new Float:health, string[20];
        GetPlayerHealth(playerid,health);
        SendClientMessage(playerid, -1, string);
       	TogglePlayerControllable(playerid, 0); //true/freeze
        SetPlayerHealth(playerid, INFINITE); //already defined
        SendClientMessage(playerid, -1, "true");
        isFrozen[playerid] = true;
//other code here
        }
    }
    else if //code here
    {
        if//code here
        {
        SetPlayerHealth(playerid, "%f")
Reply
#4

SetPlayerHealth takes a float value, not a string.
Reply
#5

Quote:
Originally Posted by frouzen
Посмотреть сообщение
What line is the error at?
Updated the thread with the whole code check it again. Thanks
Line 31.
Код:
SetPlayerHealth(playerid, %f)
Reply
#6

Try this.
PHP код:
#include <a_samp> 
#define FILTERSCRIPT 
//help by frouzen 
new isFrozen[MAX_PLAYERS]; 
new 
lastHealth[MAX_PLAYERS];
public 
OnPlayerConnect(playerid

    
isFrozen[playerid] = false;
    
lastHealth[playerid] = 0;
    return 
1

public 
OnPlayerUpdate(playerid) { 
if(
GetPlayerPing(playerid) > MAX_PING
    { 
    if(!
isFrozen[playerid]) 
        { 
            new 
string[20]; 
            
GetPlayerHealth(playeridlastHealth[playerid]); 
            
SendClientMessage(playerid, -1string); 
            
TogglePlayerControllable(playerid0); //true/freeze 
            
SetPlayerHealth(playerid999999); 
            
SendClientMessage(playerid, -1"true"); 
            
isFrozen[playerid] = true
        } 
    } 
    else if(
GetPlayerPing(playerid) < MAX_PING
    { 
        if(
isFrozen[playerid]) 
        { 
            
SetPlayerHealth(playeridlastHealth[playerid]) 
            
TogglePlayerControllable(playerid1); //false/unfreeze 
            
SendClientMessage(playerid, -1"false"); 
            
isFrozen[playerid] = false
        } 
    } 

Or this.
PHP код:
#include <a_samp> 
#define FILTERSCRIPT 
//help by frouzen 
new isFrozen[MAX_PLAYERS];
public 
OnPlayerConnect(playerid

    
isFrozen[playerid] = false;
    return 
1

public 
OnPlayerUpdate(playerid) { 
if(
GetPlayerPing(playerid) > MAX_PING
    { 
    if(!
isFrozen[playerid]) 
        { 
            new 
Float:healthstring[20]; 
            
GetPlayerHealth(playeridhealth);
        
SetPVarFloat(playerid"lastHealth"health);
            
SendClientMessage(playerid, -1string); 
            
TogglePlayerControllable(playerid0); //true/freeze 
            
SetPlayerHealth(playerid999999); 
            
SendClientMessage(playerid, -1"true"); 
            
isFrozen[playerid] = true
        } 
    } 
    else if(
GetPlayerPing(playerid) < MAX_PING
    { 
        if(
isFrozen[playerid]) 
        { 
            
SetPlayerHealth(playeridGetPVarFloat(playerid"lastHealth")); 
            
TogglePlayerControllable(playerid1); //false/unfreeze 
            
SendClientMessage(playerid, -1"false"); 
            
isFrozen[playerid] = false
        } 
    } 

Reply
#7

Thank you frouzen. +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)