Posts: 19
Threads: 5
Joined: Mar 2014
Quote:
Originally Posted by narwn
должно ловить
PHP Code:
//должно ловить
#include <a_samp>
#include <zcmd>
main();
new gHealthNOP[MAX_PLAYERS char],
gHealthFunc[MAX_PLAYERS],
gHealthGTC[MAX_PLAYERS];
new gArmourNOP[MAX_PLAYERS char],
gArmourFunc[MAX_PLAYERS],
gArmourGTC[MAX_PLAYERS];
stock ac_SetPlayerHealth(playerid, Float:health)
{
if(!SetPlayerHealth(playerid, health)) return 0;
if(floatcmp(health, 0.0) == -1) health = 0.0;
gHealthNOP{playerid} = 0;
gHealthFunc[playerid] = floatround(health, floatround_tozero);
gHealthGTC[playerid] = GetTickCount() + 500;
return 1;
}
stock ac_SetPlayerArmour(playerid, Float:armour)
{
if(!SetPlayerArmour(playerid, armour)) return 0;
if(floatcmp(armour, 0.0) == -1) armour = 0.0;
gArmourNOP{playerid} = 0;
gArmourFunc[playerid] = floatround(armour, floatround_tozero);
gArmourGTC[playerid] = GetTickCount() + 500;
return 1;
}
/*#define SetPlayerHealth ac_SetPlayerHealth
#define SetPlayerArmour ac_SetPlayerArmour*/
public OnPlayerUpdate(playerid)
{
if((gHealthFunc[playerid] != -1 || gHealthFunc[playerid] != -1) && GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
new ping = GetPlayerPing(playerid),
gtc = GetTickCount(),
Float: _offset;
GetPlayerHealth(playerid, _offset);
if(_:gHealthFunc[playerid] == _:_offset || floatcmp(gHealthFunc[playerid], _offset) >= 0 && gtc > gHealthGTC[playerid] + ping) gHealthFunc[playerid] = -1;
else if(gtc > gHealthGTC[playerid] + ping && ++gHealthNOP{playerid} > 3)
{
printf("GM(HP)");
Kick(playerid);
return 0;
}
GetPlayerArmour(playerid, _offset);
if(_:gArmourFunc[playerid] == _:_offset || floatcmp(gArmourFunc[playerid], _offset) >= 0 && gtc > gArmourGTC[playerid] + ping) gArmourFunc[playerid] = -1;
else if(gtc > gArmourGTC[playerid] + ping && ++gArmourNOP{playerid} > 3)
{
printf("GM(ARM)");
Kick(playerid);
return 0;
}
}
return 1;
}
CMD:gmcheck(playerid, params[])
{
//if(gIsAdmin{playerid} == 0)
return 0;
if(isnull(params))
return SendClientMessage(playerid, -1, !"/gmcheck [id]");
new targetid = strval(params);
if(!IsPlayerConnected(targetid))
return SendClientMessage(playerid, -1, !"* Игрока нет на сервере.");
if(targetid == playerid)
return SendClientMessage(playerid, -1, !"* Вы ввели свой ид.");
/*if(gIsAFK[targetid] > 3)
return SendClientMessage(playerid, -1, !"* Игрок в АФК.");*/
if(IsPlayerInAnyVehicle(targetid))
RemovePlayerFromVehicle(targetid);
new
Float: _last_health,
Float: _last_armour,
Float: _rand;
GetPlayerHealth(targetid, _last_health);
GetPlayerArmour(targetid, _last_armour);
_rand = float(random(99));
ac_SetPlayerHealth(targetid, _rand);
ac_SetPlayerArmour(targetid, _rand);
SetTimerEx("OnPlayerGodMode", 3000, 0, "dff", targetid, _last_health, _last_armour);
return 1;
}
forward OnPlayerGodMode(playerid, Float: _last_health, Float: _last_armour);
public OnPlayerGodMode(playerid, Float: _last_health, Float: _last_armour)
{
//if(gIsAFK[playerid] == 0)
{
SetPlayerHealth(playerid, _last_health);
SetPlayerArmour(playerid, _last_armour);
}
return;
}
|
не работает.