04.11.2017, 15:48
Try this.
Or 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(playerid, lastHealth[playerid]);
SendClientMessage(playerid, -1, string);
TogglePlayerControllable(playerid, 0); //true/freeze
SetPlayerHealth(playerid, 999999);
SendClientMessage(playerid, -1, "true");
isFrozen[playerid] = true;
}
}
else if(GetPlayerPing(playerid) < MAX_PING)
{
if(isFrozen[playerid])
{
SetPlayerHealth(playerid, lastHealth[playerid])
TogglePlayerControllable(playerid, 1); //false/unfreeze
SendClientMessage(playerid, -1, "false");
isFrozen[playerid] = false;
}
}
}
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:health, string[20];
GetPlayerHealth(playerid, health);
SetPVarFloat(playerid, "lastHealth", health);
SendClientMessage(playerid, -1, string);
TogglePlayerControllable(playerid, 0); //true/freeze
SetPlayerHealth(playerid, 999999);
SendClientMessage(playerid, -1, "true");
isFrozen[playerid] = true;
}
}
else if(GetPlayerPing(playerid) < MAX_PING)
{
if(isFrozen[playerid])
{
SetPlayerHealth(playerid, GetPVarFloat(playerid, "lastHealth"));
TogglePlayerControllable(playerid, 1); //false/unfreeze
SendClientMessage(playerid, -1, "false");
isFrozen[playerid] = false;
}
}
}