30.10.2010, 14:27
Hello
I wanted to make a anti-teleport hack script.
There are lots of misreports.
You will ban although you stand.
someone who is teleporting will not ban.
here is a part of my script
OnGameModeInit:
public:
2. public:
distanz:
example for a admin-teleport:
I hope you can help me..
sry for my bad english
Psycho
I wanted to make a anti-teleport hack script.
There are lots of misreports.
You will ban although you stand.
someone who is teleporting will not ban.
here is a part of my script
OnGameModeInit:
Код:
SetTimer("check",1000,1);
Код:
public check() { for (new i = 0; i < MAX_PLAYERS; i++) { //anti teleport: if(poscheatan[i] == 1 && Spieler[i][Admin] <= 0) //checks if the anti teleport hack is activated or not. { GetPlayerPos(i,cheatpos[0],cheatpos[1],cheatpos[2]); SetTimerEx("cheatposcheck",500,0,"i",i); //a new timer starts end ends before the timer "check" ends } else if(poscheatan[i] == 2) //is needed to activate and disable. for Example when a admin teleport him poscheatan will disable an a few secons later reactivated { poscheatan[i] = 3; } else if(poscheatan[i] == 3) { poscheatan[i] = 1; } } } } return 1; }
Код:
public cheatposcheck(playerid) { if(distanz(playerid,cheatpos[0],cheatpos[1],cheatpos[2]) >= 150) { cheater[playerid]++; new str[256],name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(str,sizeof(str),"[WARNUNG][CHEAT] %s (%d) steht und Verdacht eines Teleport-Hacks!", name, playerid); for (new j = 0; j < MAX_PLAYERS; j++) { if(Spieler[j][Admin] >= 1) { SendClientMessage(j,0x0000FFFF,str); } } if(cheater[playerid] >= 5) { new bstr[256],Spielerdatei[256]; format(bstr,sizeof(bstr),"%s wurde vom System gebannt, Grund: Teleport", name); SendClientMessageToAll(0xFF0000FF,bstr); Spieler[playerid][ban] = 1; format(Spielerdatei,sizeof(Spielerdatei),"/User/%s.ini", name); dini_Set(Spielerdatei,"bangrund","Teleport"); Kick(playerid); } } return 1; }
Код:
stock distanz(playerid,Float:x,Float:y,Float:z) { new Float:dis; new Float:x1,Float:y1,Float:z1; if (!IsPlayerConnected(playerid)) return -1; GetPlayerPos(playerid,x1,y1,z1); dis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(y,y1)),2)+floatpower(floatabs(floatsub(z,z1)),2)); return floatround(dis); }
Код:
dcmd_get(playerid,params[]) { new pID; if(sscanf(params, "u", pID)) { return SendClientMessage(playerid,COLOR_RED,"Benutzung: /get [Playerid]"); } if(!IsPlayerConnected(pID)) { return SendClientMessage(playerid,COLOR_RED,"Kein Spieler mit angegebener ID Online"); } if(Spieler[playerid][Admin] <= 1) { return SendClientMessage(playerid,COLOR_RED,"Du bist kein Admin Level 2!"); } if(Spieler[playerid][Admin]<Spieler[pID][Admin]) { return SendClientMessage(playerid,COLOR_RED,"Du kannst diesen Befehl nicht an hцherrangigen Admins ausfьhren!"); } else { poscheatan[pID] = 0; //disable.. now he can teleport new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); SetPlayerPos(pID, x+2, y+2, z+2); new admint = GetPlayerInterior(playerid); SetPlayerInterior(pID, admint); new admvrt = GetPlayerVirtualWorld(playerid); SetPlayerVirtualWorld(pID, admvrt); new aname[MAX_PLAYER_NAME], string2[256]; GetPlayerName(playerid, aname, sizeof(aname)); format(string2, sizeof(string2), "Du wurdest von %s zu sich teleportiert.", aname); SendClientMessage(pID, COLOR_RED, string2); new name[MAX_PLAYER_NAME], string[256]; GetPlayerName(pID, name, sizeof(name)); format(string, sizeof(string), "Du hast %s zu dir teleportiert.", name ); SendClientMessage(playerid, COLOR_GREEN, string); poscheatan[pID] = 2; // still disabled.. } return 1; }
sry for my bad english
Psycho