09.07.2007, 21:10
Quote:
Originally Posted by Warriors_Tornado
i have ping kicker in admin script
|
Code:
#define PING_PROTECTION 1
Code:
#define PING_PROTECTION 0
Originally Posted by Warriors_Tornado
i have ping kicker in admin script
|
#define PING_PROTECTION 1
#define PING_PROTECTION 0
Originally Posted by croherzegovina
Is this working for windows?
|
Originally Posted by lepompier
sorry link death please !
|
/******************************************************************************* Player Protections (Driveby, teamkill, helikill, spawnkill, chat spam, ping) Created 2007 - HAMM3R - Driveby detection elements adapted from code by Serafim - Modify it, erase it, explode it with a nuclear warhead... I don't care. *******************************************************************************/ #include <a_samp> // ADJUST THESE TO MODIFY EACH PROTECTION'S SETTINGS #define HELIKILL_PROTECTION 0 #define HELIKILL_MAX_KILLS 2 #define HELIKILL_TIMELIMIT 600 // 10 MINUTES #define DRIVEBY_PROTECTION 1 #define DRIVEBY_MAX_KILLS 2 #define DRIVEBY_TIMELIMIT 600 // 10 MINUTES #define TEAMKILL_PROTECTION 0 #define TEAMKILL_MAX_KILLS 5 #define TEAMKILL_TIMELIMIT 600 // 10 MINUTES #define SPAWNKILL_PROTECTION 0 #define SPAWNKILL_MAX_KILLS 4 #define SPAWNKILL_TIMELIMIT 40 // 40 SECONDS #define SPAM_PROTECTION 1 #define SPAM_MAX_MSGS 5 #define SPAM_TIMELIMIT 8 // 8 SECONDS #define PING_PROTECTION 0 #define PING_MAX_EXCEEDS 5 // Do NOT set this to 1 - Pings are very high when a player first joins #define PING_TIMELIMIT 60 // 1 MINUTE #define PING_MAX_PING 2000 // 250ms PING forward Float:GetDistanceBetweenPlayers(p1,p2); forward PingProtection(); new gSpamCount[MAX_PLAYERS][2]; new gTeamkillCount[MAX_PLAYERS][2]; new gHelikillCount[MAX_PLAYERS][2]; new gSpawnkillCount[MAX_PLAYERS][MAX_PLAYERS][2]; new gDrivebyCount[MAX_PLAYERS][2]; new gPingCount[MAX_PLAYERS][2]; public OnFilterScriptInit() { #if PING_PROTECTION SetTimer("PingProtection", 5000, 1); #endif return 1; } public OnPlayerConnect(playerid) { gTeamkillCount[playerid][0] = 0; gTeamkillCount[playerid][1] = 0; gHelikillCount[playerid][0] = 0; gHelikillCount[playerid][1] = 0; gDrivebyCount[playerid][0] = 0; gDrivebyCount[playerid][1] = 0; gSpamCount[playerid][0] = 0; gSpamCount[playerid][1] = 0; gPingCount[playerid][0] = 0; gPingCount[playerid][1] = 0; for(new x=0; x<MAX_PLAYERS; x++) { gSpawnkillCount[playerid][x][0] = 0; gSpawnkillCount[playerid][x][1] = 0; } return 1; } public OnPlayerText(playerid, text[]) { #if SPAM_PROTECTION SpamProtection(playerid); #endif return 1; } public OnPlayerDeath(playerid, killerid, reason) { if(reason == 50) { #if HELIKILL_PROTECTION HelikillProtection(killerid); #endif } if(GetPlayerTeam(killerid) == GetPlayerTeam(playerid)) { #if TEAMKILL_PROTECTION TeamkillProtection(killerid); #endif } if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER && (reason == WEAPON_TEC9 || reason == WEAPON_UZI || reason == WEAPON_MP5) && GetDistanceBetweenPlayers(playerid,killerid) < 100) { #if DRIVEBY_PROTECTION DrivebyProtection(killerid); #endif } #if SPAWNKILL_PROTECTION SpawnkillProtection(killerid,playerid); #endif return 1; } stock TeamkillProtection(killerid) { new string[64]; if(gTeamkillCount[killerid][0] == 0) { gTeamkillCount[killerid][1] = TimeStamp(); } gTeamkillCount[killerid][0]++; if(TimeStamp() - gTeamkillCount[killerid][1] > DRIVEBY_TIMELIMIT) { gTeamkillCount[killerid][0] = 1; gTeamkillCount[killerid][1] = TimeStamp(); } else if(gTeamkillCount[killerid][0] == DRIVEBY_MAX_KILLS) { format(string,sizeof(string),"*** %s has been kicked (Excessive teamkilling)",GetName(killerid)); SendClientMessageToAll(0xC8BEBEAA,string); Kick(killerid); } else if(gTeamkillCount[killerid][0] == DRIVEBY_MAX_KILLS-1) { SendClientMessage(killerid,0xC8BEBEAA,"*** Stop teamkilling - Next one is a kick"); } return 1; } stock HelikillProtection(killerid) { new string[64]; if(gHelikillCount[killerid][0] == 0) { gHelikillCount[killerid][1] = TimeStamp(); } gHelikillCount[killerid][0]++; if(TimeStamp() - gHelikillCount[killerid][1] > HELIKILL_TIMELIMIT) { gHelikillCount[killerid][0] = 1; gHelikillCount[killerid][1] = TimeStamp(); } else if(gHelikillCount[killerid][0] == HELIKILL_MAX_KILLS) { format(string,sizeof(string),"*** %s has been kicked (Excessive helikilling)",GetName(killerid)); SendClientMessageToAll(0xC8BEBEAA,string); Kick(killerid); } else if(gHelikillCount[killerid][0] == HELIKILL_MAX_KILLS-1) { SendClientMessage(killerid,0xC8BEBEAA,"*** Stop helikilling - Next one is a kick"); } return 1; } stock DrivebyProtection(killerid) { new string[64]; if(gDrivebyCount[killerid][0] == 0) { gDrivebyCount[killerid][1] = TimeStamp(); } gDrivebyCount[killerid][0]++; if(TimeStamp() - gDrivebyCount[killerid][1] > DRIVEBY_TIMELIMIT) { gDrivebyCount[killerid][1] = TimeStamp(); gDrivebyCount[killerid][0] = 1; } else if(gDrivebyCount[killerid][0] == DRIVEBY_MAX_KILLS) { format(string,sizeof(string),"*** %s has been kicked (Excessive drivebying)",GetName(killerid)); SendClientMessageToAll(0xC8BEBEAA,string); Kick(killerid); } else if(gDrivebyCount[killerid][0] == DRIVEBY_MAX_KILLS-1) { SendClientMessage(killerid,0xC8BEBEAA,"*** Pбra com o drivebying - Prуxima vez serб kick ou BAN !!!"); } return 1; } stock SpawnkillProtection(killerid, playerid) { new string[64]; if(gSpawnkillCount[killerid][playerid][0] == 0) { gSpawnkillCount[killerid][playerid][1] = TimeStamp(); } gSpawnkillCount[killerid][playerid][0]++; if(TimeStamp() - gSpawnkillCount[killerid][playerid][1] > SPAWNKILL_TIMELIMIT) { gSpawnkillCount[killerid][playerid][0] = 1; gSpawnkillCount[killerid][playerid][1] = TimeStamp(); } else if(gSpawnkillCount[killerid][playerid][0] == SPAWNKILL_MAX_KILLS) { format(string,sizeof(string),"*** %s has been kicked (Spawnkilling)",GetName(killerid)); SendClientMessageToAll(0xC8BEBEAA,string); Kick(killerid); } else if(gSpawnkillCount[killerid][playerid][0] == SPAWNKILL_MAX_KILLS-1) { SendClientMessage(killerid,0xC8BEBEAA,"*** Stop spawnkilling - Next one is a kick"); } return 1; } stock SpamProtection(playerid) { new string[64]; if(gSpamCount[playerid][0] == 0) { gSpamCount[playerid][1] = TimeStamp(); } gSpamCount[playerid][0]++; if(TimeStamp() - gSpamCount[playerid][1] > SPAM_TIMELIMIT) { gSpamCount[playerid][0] = 1; gSpamCount[playerid][1] = TimeStamp(); } else if(gSpamCount[playerid][0] == SPAM_MAX_MSGS) { format(string,sizeof(string),"*** %s foi expluso por Flood/Spam (Protection)",GetName(playerid)); SendClientMessageToAll(0xC8BEBEAA,string); Kick(playerid); } // Best not to help them figure out the time limits /*else if(gSpamCount[playerid][0] == SPAM_MAX_MSGS-1) { SendClientMessage(playerid,0xC8BEBEAA,"*** Stop spamming - Next one is a kick"); }*/ return 1; } public PingProtection() { new string[64]; for(new x=0; x<MAX_PLAYERS; x++) { if(GetPlayerPing(x) > PING_MAX_PING) { if(gPingCount[x][0] == 0) { gPingCount[x][1] = TimeStamp(); } gPingCount[x][0]++; if(TimeStamp() - gPingCount[x][1] > PING_TIMELIMIT) { gPingCount[x][1] = TimeStamp(); gPingCount[x][0] = 1; } else if(gPingCount[x][0] == PING_MAX_EXCEEDS) { format(string,sizeof(string),"*** %s desliga os downloads (Ping Exceeds %dms)",GetName(x), PING_MAX_PING); SendClientMessageToAll(0xC8BEBEAA,string); Kick(x); } } } return 1; } stock Float:GetDistanceBetweenPlayers(p1,p2) { new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2; if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)){ return -1.00; } GetPlayerPos(p1,x1,y1,z1); GetPlayerPos(p2,x2,y2,z2); return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2)); } stock GetName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); return name; } stock TimeStamp() { new time = GetTickCount() / 1000; return time; }
Originally Posted by Vyorel
C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(115) : warning 217: loose indentation
C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(116) : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(136) : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(137) : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(157) : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(15 : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(160) : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(17 : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(179) : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(199) : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(200) : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(224) : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(225) : warning 217: loose indentation C:\Documents and Settings\Huni.MONICA\Desktop\samp02Xserver.win32\f ilterscripts\playerprotection.pwn(227) : warning 217: loose indentation Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 14 Warnings. |