ffkick prot: Ban caller of against-admin vote

This commit is contained in:
Jackzie 2021-10-05 14:04:19 -05:00
parent 2f54c1c52b
commit 17d7925114
No known key found for this signature in database
GPG key ID: 1E834FE36520537A

View file

@ -59,21 +59,24 @@ public void Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast)
public Action VoteStart(int client, const char[] command, int argc) { public Action VoteStart(int client, const char[] command, int argc) {
if(GetClientCount(true) == 0 || client == 0) return Plugin_Handled; //prevent votes while server is empty or if server tries calling vote if(GetClientCount(true) == 0 || client == 0) return Plugin_Handled; //prevent votes while server is empty or if server tries calling vote
if(argc >= 1) { if(argc >= 1) {
char issue[32]; static char issue[32];
char caller[32];
GetCmdArg(1, issue, sizeof(issue)); GetCmdArg(1, issue, sizeof(issue));
Format(caller, sizeof(caller), "%N", client);
if(StrEqual(issue, "Kick", false)) { if(StrEqual(issue, "Kick", false)) {
char option[32]; static char option[32];
GetCmdArg(2, option, sizeof(option)); GetCmdArg(2, option, sizeof(option));
if(strlen(option) < 1) { //empty userid/console can't call votes if(strlen(option) < 1) { //empty userid/console can't call votes
int target = GetClientOfUserId(StringToInt(option)); int target = GetClientOfUserId(StringToInt(option));
if(target == 0) return Plugin_Continue; //invalid, pass it through
AdminId callerAdmin = GetUserAdmin(client); AdminId callerAdmin = GetUserAdmin(client);
AdminId targetAdmin = GetUserAdmin(target); AdminId targetAdmin = GetUserAdmin(target);
if(callerAdmin == INVALID_ADMIN_ID && targetAdmin != INVALID_ADMIN_ID) { if(targetAdmin != INVALID_ADMIN_ID) {
PrintToChat(target, "%N has attempted to vote kick you.", client); PrintToChat(target, "%N has attempted to vote kick you.", client);
if(callerAdmin == INVALID_ADMIN_ID) {
BanClient(client, 0, 0, "Attempted Vote Kick Admin", "Dick-Be-Gone", "noFF");
}
return Plugin_Handled; return Plugin_Handled;
} }
if(GetClientTeam(target) == 2) { if(GetClientTeam(target) == 2) {