Код:
#include <a_samp>
#define COLOR_RED 0xAA3333AA
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 //CREDIT: DracoBlue
new Float:x[MAX_PLAYERS];
new Float:y[MAX_PLAYERS];
new Float:z[MAX_PLAYERS];
public OnFilterScriptInit()
{
print("Anti-Esc by GhOsT[X]");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(esc,3,cmdtext);
return 1;
}
dcmd_esc(playerid,params[])
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,"Use: /esc (playerid");
return true;
}
new pid = strval(tmp);
new cmderid = playerid;
if(!IsPlayerConnected(pid) || GetPlayerInterior(pid) != 0 || GetPlayerInterior(playerid) != 0)
{
SendClientMessage(playerid,COLOR_RED,"ID Invalido ou Voce/Jogador esta em um interior.");
return true;
}
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string2[256], string[256];
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string2, sizeof(string2), "Voce usou /esc no jogador: %s.", pname2);
SendClientMessage(playerid,COLOR_RED, string2);
format(string, sizeof(string), "Jogador: %s usou /esc em voce.", pname);
SendClientMessage(pid,COLOR_RED, string);
GetPlayerPos(pid,x[pid],y[pid],z[pid]);
SetTimerEx("CheckEsc", 3000,0,"dd", pid,cmderid);
return 1;
}
forward CheckEsc(playerid,cmderid);
public CheckEsc(playerid,cmderid)
{
new Float:fX,Float:fY,Float:fZ;
new pname3[MAX_PLAYER_NAME];
new pname4[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname3, sizeof(pname3));
GetPlayerName(playerid, pname4, sizeof(pname4));
if(GetPlayerPos(playerid,fX,fY,fZ) == GetPlayerPos(playerid,x[playerid],y[playerid],z[playerid]))
{
Kick(playerid);
new string4[256];
format(string4, sizeof(string4), "Jogador: %s foi kickado por esc por .", pname3,pname4);
SendClientMessage(cmderid,COLOR_RED, string4);
SendClientMessage(playerid,COLOR_RED, "Voce foi kickado por esc");
Kick(playerid);
}else{
new string3[256];
format(string3, sizeof(string3), "Jogador: %s nгo esta de esc.", pname3);
SendClientMessage(cmderid,COLOR_RED, string3);
}
}
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;
}