Raised This Month: $51 Target: $400
 12% 

Player respawn menu for admins after TK


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Obyboby
Veteran Member
Join Date: Sep 2013
Old 06-22-2017 , 04:18   Player respawn menu for admins after TK
Reply With Quote #1

Okay so correct me if there's something easier than this.
Since mp_spawnprotectiontime doesn't seem to work for me, I need a plugin to help stop players that kill their team mates at spawn.
I installed eylonap_multicommands which gave me the option to !respawn a player, so that if an admin is in game, and notices a teamkill, he is able to at least respawn the player using that command.
What I was thinking is:
How about a plugin that shows a popup to any admin in game, after a teamkill occurs, showing the option to respawn the player? And perhaps add the ability to restore the health points and equipment they had at the time of the teamkill?
"Player X was teamkilled by player Y, respawn?" "Yes" "No"
After that, another menu with the available punishment for the teamkiller <---- Either for the victim or the admin, I don't know.. perhaps a kick/ban (with ban duration options) for admins, and a "standard" tkmenu for players with slap/slay etc.

Well the most important part I'd need is the respawn menu, i believe there should be a tkmenu plugin already..not sure whether it works on CSGO but I'm pretty sure I've seen it somewhere.
Thanks!
__________________

Last edited by Obyboby; 06-22-2017 at 04:18.
Obyboby is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 06-22-2017 , 05:18   Re: Player respawn menu for admins after TK
Reply With Quote #2

Why don't you use this ? It has round start protection too.

https://forums.alliedmods.net/showthread.php?p=714326

Or this for menu

https://forums.alliedmods.net/showthread.php?p=1841274

Last edited by WatchDogs; 06-22-2017 at 05:20.
WatchDogs is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 06-22-2017 , 05:46   Re: Player respawn menu for admins after TK
Reply With Quote #3

Quote:
Originally Posted by WatchDogs View Post
Why don't you use this ? It has round start protection too.

https://forums.alliedmods.net/showthread.php?p=714326

Or this for menu

https://forums.alliedmods.net/showthread.php?p=1841274
First one doesn't work in csgo, according to the latest replies to the thread.
Second one, could be something, but I'd love to have the menu popup for the admins to take immediate action.
Also what can I use to insta-kick whoever teamkills at the beginning of the round?
__________________
Obyboby is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 06-22-2017 , 06:04   Re: Player respawn menu for admins after TK
Reply With Quote #4

OK. Wait i'm editing tk menu plugin. It takes some time
WatchDogs is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 06-22-2017 , 06:43   Re: Player respawn menu for admins after TK
Reply With Quote #5

Not tested.I added Round Protection & edited plugin to show menu to admins with 4 items:

Code:
Just Respawn Victim
Give 25% Cash of Killer to Victim - Respawn Victim
Slay Killer - Respawn Victim
Kick Killer - Respawn Victim
Also this cvars:

Code:
tk_round_protect_enable "1" - Enable / Disable round protection
tk_round_protect_time "10" - Round protection time in seconds
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <cstrike>

new Handle:h_iProtectTime;
new 
Handle:h_bProtectEnable;
new 
String:KillerList[MAXPLAYERS+1][MAX_NAME_LENGTH+1];
new 
String:VictimList[MAXPLAYERS+1][MAX_NAME_LENGTH+1];
new 
KilledBy[MAXPLAYERS+1];
new 
ACCOUNT_OFFSET;

#define PLUGIN_VERSION "1.2"

public Plugin:myinfo =
{
    
name "Simple CS:GO TK Menu + Round Start Protection",
    
author "Sheepdude",
    
description "Displays a TK Menu that lets TK victims steal cash",
    
version PLUGIN_VERSION,
    
url "http://www.clan-psycho.com"
};

public 
OnPluginStart()
{
    
h_bProtectEnable CreateConVar("tk_round_protect_enable""1""Enable / Disable round protection"_true0.0true1.0);
    
h_iProtectTime CreateConVar("tk_round_protect_time""10""Round protection time in seconds"_true1.0);
    
    
ACCOUNT_OFFSET FindSendPropOffs("CCSPlayer""m_iAccount");
    
HookEventEx("player_death"PlayerDeathEvent);
    
HookEvent("round_start"OnRoundStart);
}

public 
Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if(!
GetConVarBool(h_bProtectEnable))
        return 
Plugin_Continue;
        
    for (new 
1<= MaxClientsi++)
    {
        if(
IsClientInGame(i))
        {
            
SetEntProp(iProp_Data"m_takedamage"01);
        }
    }
    
CreateTimer(GetConVarFloat(h_iProtectTime), RemoveProtection_TIMER_FLAG_NO_MAPCHANGE);
    return 
Plugin_Continue;
}

public 
PlayerDeathEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
victim GetClientOfUserId(GetEventInt(event,"userid"));
    new 
killer GetClientOfUserId(GetEventInt(event,"attacker"));
    
GetClientName(killerKillerList[victim], sizeof(KillerList[]));
    
GetClientName(victimVictimList[victim], sizeof(VictimList[]));
    
KilledBy[victim] = killer;
    if(
victim && victim <= MaxClients && killer && killer <= MaxClients && GetClientTeam(victim) == GetClientTeam(killer) && victim != killer && !IsFakeClient(victim))
    {
        for (new 
1<= MaxClientsi++)
        {
            if(
IsClientInGame(i) && !IsFakeClient(i) && GetUserAdmin(i) != INVALID_ADMIN_ID)
            {
                
doTKMenu(ivictim);
            }
        }
    }
}

public 
doTKMenu(clientvictim)
{
    
decl String:menuTitle[64], String:sVictim[8];
    
Format(menuTitlesizeof(menuTitle), "Team Killer! %s were killed by %s, choose an action:"VictimList[victim], KillerList[victim]);
    
IntToString(victimsVictimsizeof(sVictim));
    
    new 
Handle:menu CreateMenu(handleTKVoteMenu);
    
SetMenuTitle(menumenuTitle);
    
AddMenuItem(menusVictim"Just Respawn Victim");
    
AddMenuItem(menusVictim"Give 25\% Cash of Killer to Victim - Respawn Victim");
    
AddMenuItem(menusVictim"Slay Killer - Respawn Victim");
    
AddMenuItem(menusVictim"Kick Killer - Respawn Victim");
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

public 
handleTKVoteMenu(Handle:menuMenuAction:actionparam1param2
{
    if (
action == MenuAction_End
    {
        
CloseHandle(menu);
    }
    else if (
action == MenuAction_Select)
    {
        
decl String:sItem[8];
        
GetMenuItem(menuparam2sItemsizeof(sItem));
        new 
victim StringToInt(sItem);
        if(
param2 == 0)
        {
            
PrintToChatAll("\x01\x0B\x04[TKMenu]\x01 %s was respawned by admin"VictimList[victim]);
            
CS_RespawnPlayer(victim);
        }
        else if(
param2 == && IsClientInGame(victim) && IsClientInGame(KilledBy[victim]))
        {
            new 
KillerMoney GetEntData(KilledBy[victim], ACCOUNT_OFFSET4);
            new 
VictimMoney GetEntData(victimACCOUNT_OFFSET4);
            new 
difference RoundToFloor(KillerMoney 0.25);
            
SetEntData(KilledBy[victim], ACCOUNT_OFFSETKillerMoney difference4true);
            if(
VictimMoney difference 16000)
                
SetEntData(victimACCOUNT_OFFSET160004true);
            else
                
SetEntData(victimACCOUNT_OFFSETVictimMoney difference4true);
            
PrintToChatAll("\x01\x0B\x04[TKMenu]\x01 %s stole \x05$%d\x01 from %s for team killing."VictimList[victim], differenceKillerList[victim]);
            
CS_RespawnPlayer(victim);
        }
        else if(
param2 == && IsClientInGame(KilledBy[victim]))
        {
            
CreateTimer(0.0SlayKilledBy[victim], TIMER_FLAG_NO_MAPCHANGE);
            
PrintToChatAll("\x01\x0B\x04[TKMenu]\x01 %s was slain for team killing %s."KillerList[victim], VictimList[victim]);
            
CS_RespawnPlayer(victim);
        }
        else if(
param2 == && IsClientInGame(KilledBy[victim]))
        {
            
KickClient(KilledBy[victim], "Kicked By Admin. Reason: Team Killing");
            
PrintToChatAll("\x01\x0B\x04[TKMenu]\x01 %s was kicked for team killing %s."KillerList[victim], VictimList[victim]);
            
CS_RespawnPlayer(victim);
        }
    }
}

public 
Action:Slay(Handle:timerany:client)
{
    
ForcePlayerSuicide(client);
}

public 
Action:RemoveProtection(Handle:timer)
{
    for (new 
1<= MaxClientsi++)
    {
        if(
IsClientInGame(i))
        {
            
SetEntProp(iProp_Data"m_takedamage"21);
        }
    }


EDIT: Updated to 1.2 | Fixed a bug
Attached Files
File Type: sp Get Plugin or Get Source (tkmenu.sp - 242 views - 4.8 KB)

Last edited by WatchDogs; 06-22-2017 at 06:57.
WatchDogs is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 06-22-2017 , 08:00   Re: Player respawn menu for admins after TK
Reply With Quote #6

Thanks, I installed it and will test!
Question: so the MODERATORS get the menu and not the victim right?
What if there are multiple mods on the server? And ideally two mods choose two differnent options at the same time?
Like mod A clicks steal cash, mod B clicks slay (example), I guess the plugin just takes the first command?
__________________
Obyboby is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 06-22-2017 , 08:11   Re: Player respawn menu for admins after TK
Reply With Quote #7

Yes menu is only for admins.

You can choose one option only. If you want I can add more options.
WatchDogs is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 06-22-2017 , 08:46   Re: Player respawn menu for admins after TK
Reply With Quote #8

Quote:
Originally Posted by WatchDogs View Post
Yes menu is only for admins.

You can choose one option only. If you want I can add more options.
"Ban player" that opens another menu with "10 minutes - 1 hour - 1 day - permanent" is this possible?
__________________
Obyboby is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 07-03-2017 , 02:47   Re: Player respawn menu for admins after TK
Reply With Quote #9

Here you are. Sorry for late.
Attached Files
File Type: sp Get Plugin or Get Source (tkmenu.sp - 241 views - 6.0 KB)

Last edited by WatchDogs; 07-03-2017 at 03:39.
WatchDogs is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode