Команда антигодмода, доступна для всех юзеров... Синтаксис: /killgm [id]
Code
//
// Coded by 009
// Anti God Mod - /killgm
//
#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>
forward Fire();
new FireId[MAX_PLAYERS];
new Float:FireHealth[MAX_PLAYERS];
new Timer;
public OnFilterScriptInit()
{
print("__________________________");
print("Anti God Mod by 009 loaded");
print("__________________________");
Timer = SetTimer("Fire",500,1);
for(new i = 0;i < MAX_PLAYERS;i++) FireId[i] = INVALID_PLAYER_ID;
}
public OnFilterScriptExit()
{
print("____________________________");
print("Anti God Mod by 009 unloaded");
print("____________________________");
KillTimer(Timer);
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' ')) index++;
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[20],
idx;
cmd = strtok(cmdtext,idx);
if(strcmp(cmd, "/killgm", true) == 0)
{
cmd = strtok(cmdtext, idx);
if(!strlen(cmd)) return 1;
new id = strval(cmd);
if(!IsPlayerConnected(id)) return 1;
FireId[playerid] = id;
GetPlayerHealth(id,FireHealth[playerid]);
return 1;
}
return 0;
}
public Fire()
{
for(new playerid=0;playerid<200;playerid++)
{
if(!IsPlayerConnected(playerid)) continue;
if(FireId[playerid] == INVALID_PLAYER_ID) continue;
if(IsPlayerConnected(FireId[playerid]))
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(FireId[playerid],X,Y,Z);
SetPlayerPos(playerid,X+random(6)-random(6),Y+random(6)-random(6),Z);
TurnPlayerFaceToPlayer(playerid, FireId[playerid]);
SetCameraBehindPlayer(playerid);
FireHealth[playerid] = FireHealth[playerid] - 10.0;
SetPlayerHealth(FireId[playerid],FireHealth[playerid]);
if(floatcmp(FireHealth[playerid],0.0) != 1) FireId[playerid] = INVALID_PLAYER_ID;
}
else FireId[playerid] = INVALID_PLAYER_ID;
}
}
stock TurnPlayerFaceToPlayer(playerid, facingtoid)
{
new Float:angle;
new Float:x, Float:y, Float:z;
new Float:ix, Float:iy, Float:iz;
GetPlayerPos(facingtoid, x, y, z);
GetPlayerPos(playerid, ix, iy, iz);
angle = -atan2(ix-x,iy-y);
if(angle > 360.0) angle -= 180.0;
if(angle < 0) angle = 360.0 + angle;
SetPlayerFacingAngle(playerid, angle);
}