SetPlayerHealth %f
#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


Messages In This Thread
SetPlayerHealth %f - by billy1337samp - 04.11.2017, 15:18
Re: SetPlayerHealth %f - by frouzen - 04.11.2017, 15:31
Re: SetPlayerHealth %f - by Ponga - 04.11.2017, 15:32
Re: SetPlayerHealth %f - by J0sh... - 04.11.2017, 15:33
Re: SetPlayerHealth %f - by billy1337samp - 04.11.2017, 15:34
Re: SetPlayerHealth %f - by frouzen - 04.11.2017, 15:48
Re: SetPlayerHealth %f - by billy1337samp - 04.11.2017, 16:04

Forum Jump:


Users browsing this thread: 2 Guest(s)