Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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] carregado");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("Anti-Esc by GhOsT[X] descarregado");
- 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);
- 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));
- GetPlayerName(pid, pname, sizeof(pname));
- format(string2, sizeof(string2), "Voce usou /esc no jogador: %s.", pname);
- SendClientMessage(playerid,COLOR_RED, string2);
- format(string, sizeof(string), "Jogador: %s usou /esc em voce.", pname2);
- SendClientMessage(pid,COLOR_RED, string);
- GetPlayerPos(pid,Float:x[pid],Float:y[pid],Float:z[pid]);
- SetTimerEx("CheckEsc", 10000, 0, "dd", playerid, pid);
- return 1;
- }
- forward CheckEsc(pid,playerid);
- public CheckEsc(pid,playerid)
- {
- new pname3[MAX_PLAYER_NAME];
- new pname4[MAX_PLAYER_NAME];
- GetPlayerName(pid, pname3, sizeof(pname3));
- GetPlayerName(playerid, pname4, sizeof(pname4));
- new Float:fX,Float:fY,Float:fZ;
- GetPlayerPos(pid,fX,fY,fZ);
- if(x[pid] == fX)
- {
- new string4[256];
- format(string4, sizeof(string4), "Jogador: %s foi kickado por esc por %s.", pname3,pname4);
- SendClientMessageToAll(COLOR_RED, string4);
- SendClientMessage(pid,COLOR_RED, "Voce foi kickado por esc");
- Kick(pid);
- }else{
- new string3[256];
- format(string3, sizeof(string3), "Jogador: %s não esta de esc.", pname3);
- SendClientMessage(playerid,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;
- }
Advertisement
Add Comment
Please, Sign In to add comment