Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /****************************************************
- SISTEMA ANTI-ESC
- *****************************************************
- * *
- * Creditos *
- * *
- * Criador Geral: Dark.Angel_ *
- * Agradecimentos: Iron - Ajudou a testar o FS *
- * *
- * !!! Não retire os creditos !!! *
- ****************************************************/
- #include <a_samp>
- forward CheckarPosicao(playerid,giveplayerid,Float:X,Float:Y,Float:Z);
- forward LiberarCmd(playerid);
- new String[128];
- new bool:AntiFloodCmdEsc[MAX_PLAYERS];
- public OnPlayerCommandText(playerid,cmdtext[])
- {
- new tmp[128]; new cmd[256]; new idx; new giveplayerid;
- cmd = strtok(cmdtext,idx);
- if (strcmp(cmd,"/esc",true) == 0)
- {
- tmp = strtok(cmdtext,idx);
- giveplayerid = strval(tmp);
- if (!strlen(tmp)) return SendClientMessage(playerid,0xF67100AA,"Digite: /esc [ID do Jogador]");
- if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,0xF60000AA,"[ANTI-ESC] Este jogador não esta conectado");
- if (AntiFloodCmdEsc[playerid] == true) return SendClientMessage(playerid,0xF60000AA,"[ANTI-ESC] Você deve esperar alguns segundos para re-utilizar este comando");
- if (giveplayerid == playerid) return SendClientMessage(playerid,0xF60000AA,"[ANTI-ESC] Digite um ID diferente do seu");
- new Float:Posicao[3];
- GetPlayerPos(giveplayerid,Posicao[0],Posicao[1],Posicao[2]);
- if (IsPlayerInRangeOfPoint(playerid,30.0,Posicao[0],Posicao[1],Posicao[2]))
- {
- SetTimerEx("CheckarPosicao",8000,false,"iifff",playerid,giveplayerid,Posicao[0],Posicao[1],Posicao[2]);
- format(String,128,"[ANTI-ESC] Você esta sendo reportado por ESC pelo jogador %s(id:%i), se você não se mover em 8 segundos você sera kickado do servidor",Nome(playerid),playerid);
- SendClientMessage(giveplayerid,0xF60000AA,String);
- SetTimerEx("LiberarCmd",45000,false,"i",playerid);
- format(String,128,"[ANTI-ESC] Você esta reportando o jogador %s(id:%i) por estar de ESC",Nome(giveplayerid),giveplayerid);
- SendClientMessage(playerid,0x32EDE0AA,String);
- AntiFloodCmdEsc[playerid] = true;
- }
- else SendClientMessage(playerid,0xF60000AA,"[ANTI-ESC] Você deve estar a menos de 30 metros do reportado");
- return true;
- }
- return false;
- }
- public CheckarPosicao(playerid,giveplayerid,Float:X,Float:Y,Float:Z)
- {
- new Float:Position[3];
- GetPlayerPos(giveplayerid,Position[0],Position[1],Position[2]);
- if (Position[0] == X && Position[1] == Y && Position[2] == Z)
- {
- format(String,128,"[ANTI-ESC] O jogador %s(id:%i) foi kickado por ficar de ESC . %s(id:%i) usou o sistema ANTI-ESC para isso",Nome(giveplayerid),giveplayerid,Nome(playerid),playerid);
- SendClientMessageToAll(0x00BC9AAA,String);
- Kick(giveplayerid);
- }
- else
- {
- format(String,128,"[ANTI-ESC] O jogador %s(id:%i) não esta de ESC",Nome(giveplayerid),giveplayerid);
- SendClientMessage(playerid,0x00F6F6AA,String);
- }
- }
- public LiberarCmd(playerid) AntiFloodCmdEsc[playerid] = false;
- public OnPlayerConnect(playerid) SendClientMessage(playerid,0xF67500AA,"Este servidor utiliza Sistema Anti-ESC criado por Dark.Angel_");
- stock Nome(playerid)
- {
- new Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
- return Name;
- }
- 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
Advertisement