Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- //Variáveis globais
- new TimerTeleportCP[MAX_PLAYERS];
- //Variável da posição do jogador
- enum posInfo
- {
- Float:pX,
- Float:pY,
- Float:pZ,
- Float:pA
- };
- new pos_info[MAX_PLAYERS][posInfo];
- public OnFilterScriptInit()
- {
- print("****************************************************************");
- print("* *");
- print("* Sistema anti Race Checkpoint cheater carregado! *");
- print("* Criado por Rafael Hirsch (Maudruga) *");
- print("* *");
- print("****************************************************************");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- //Cancelar o timer ao de desconectar!
- KillTimer(TimerTeleportCP[playerid]);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- //Cancelar o timer ao dar spawn!
- KillTimer(TimerTeleportCP[playerid]);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- //Cancelar o timer ao morrer!
- KillTimer(TimerTeleportCP[playerid]);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- //Aconselho para que inicentes não sejam punidos, usar essa função --> KillTimer(TimerTeleportCP[playerid]);
- //em todos comandos de teleportes disponiveis na corrida, principalmente no de "/sair" da corrida.
- //EXEMPLO:
- if (strcmp("/saircorrida", cmdtext, true, 10) == 0)
- {
- //Cancelar o timer ao dar o comando "/saircorrida" !
- KillTimer(TimerTeleportCP[playerid]);
- //Outras funções...
- return 1;
- }
- return 0;
- }
- //Ao entrar em um "Race Checkpoint" ele fará...
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- //Pega a posição do jogador que entrou no "Race Checkpoint".
- GetPlayerPos(playerid, pos_info[playerid][pX], pos_info[playerid][pY], pos_info[playerid][pZ]);
- //Inicia a contagem para chamar o função "AntiCP"
- TimerTeleportCP[playerid]= SetTimerEx("AntiCP",1000,0, "i", playerid);
- return 1;
- }
- //Função que foi chamada pelo settimer depois de 1s
- forward AntiCP(playerid);
- public AntiCP(playerid)
- {
- //Se ele estiver em um raio de 70.0 não acontecerá nada!
- if(IsPlayerInRangeOfPoint(playerid, 70.0, pos_info[playerid][pX], pos_info[playerid][pY], pos_info[playerid][pZ]))
- {
- //Aqui é a função que será feita se não for um "cheater", aconselho deixar vazio.
- }
- //Se ele não tiver no ráio de 70.0 ele será acusado como "cheater"!
- else
- {
- new CheaterStr[128];//Seta quantos caracteres podem estar na string "CheaterStr"
- new name[MAX_PLAYER_NAME];//Variável local que pega o nome do cheater.
- GetPlayerName(playerid, name, sizeof(name));//Pega o nome do cheater.
- format(CheaterStr, sizeof(CheaterStr), "%s está usando \"Cheater\"!", name);//Formata a mensagem para ser mandada.
- SendClientMessageToAll(128,CheaterStr);//Manda a mensagem para todos os players.
- Kick(playerid); //Kickar jogador.
- //BanEx(playerid, CheaterStr); //Banir jogador "Opsional"
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement