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

Need respawn plugin that asks if u want to respawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pizzadaking
Member
Join Date: Oct 2019
Old 04-02-2020 , 14:57   Need respawn plugin that asks if u want to respawn
Reply With Quote #1

So i just want an respawn plugin that asks the player that died if the player wants to respawn or not as the plugin in the picture
https://i.imgur.com/LKzJBQL.jpg
Pizzadaking is offline
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 04-02-2020 , 18:44   Re: Need respawn plugin that asks if u want to respawn
Reply With Quote #2

bb (basebuilder) already respawns someone when he/she dies, just asking, if it already respawns you, why would you need that?
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-03-2020 , 06:53   Re: Need respawn plugin that asks if u want to respawn
Reply With Quote #3

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "RespawnMenu"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

new szMenu;
new 
iTeam;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
RegisterHam(Ham_Killed"player""PostPlayerKilled"1);
    
    
szMenu menu_create("\w[\rBB\w]\y Respawn?""RespawnHandler");
    
    
menu_additem(szMenu"\wYes");
    
menu_additem(szMenu"\wNo");
    
    
menu_setprop(szMenuMPROP_NUMBER_COLOR"\r");
}

public 
PostPlayerKilled(iVictimiAttackeriShouldGib)
{
    
iTeam get_user_team(iVictim);
    
    if(!
is_user_alive(iVictim) && (iTeam == || iTeam == 2))
    {
        
menu_display(iVictimszMenu)
    }
}

public 
RespawnHandler(idszMenuitem)
{
    
iTeam get_user_team(id);
    
    if(!
is_user_alive(id) && (iTeam == || iTeam == 2))
    {
        switch(
item)
        {
            case 
0ExecuteHamB(Ham_CS_RoundRespawnid);
            case 
1: return PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_HANDLED

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
wy19850
Member
Join Date: Feb 2020
Location: suzhou
Old 04-04-2020 , 13:03   Re: Need respawn plugin that asks if u want to respawn
Reply With Quote #4

Quote:
Originally Posted by Napoleon_be View Post
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "RespawnMenu"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

new szMenu;
new 
iTeam;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
RegisterHam(Ham_Killed"player""PostPlayerKilled"1);
    
    
szMenu menu_create("\w[\rBB\w]\y Respawn?""RespawnHandler");
    
    
menu_additem(szMenu"\wYes");
    
menu_additem(szMenu"\wNo");
    
    
menu_setprop(szMenuMPROP_NUMBER_COLOR"\r");
}

public 
PostPlayerKilled(iVictimiAttackeriShouldGib)
{
    
iTeam get_user_team(iVictim);
    
    if(!
is_user_alive(iVictim) && (iTeam == || iTeam == 2))
    {
        
menu_display(iVictimszMenu)
    }
}

public 
RespawnHandler(idszMenuitem)
{
    
iTeam get_user_team(id);
    
    if(!
is_user_alive(id) && (iTeam == || iTeam == 2))
    {
        switch(
item)
        {
            case 
0ExecuteHamB(Ham_CS_RoundRespawnid);
            case 
1: return PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_HANDLED




In CS1.5 test collapse, CS1.6 without option is and is not, come back. Again, optimization, CS1.5 run it. thank you
wy19850 is offline
Send a message via Skype™ to wy19850
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-04-2020 , 13:26   Re: Need respawn plugin that asks if u want to respawn
Reply With Quote #5

Added some non-functional tweaks & comments to that code.
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "RespawnMenu"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

//Not an impact to functionality but it is good habit to use proper variable naming convention
//to improve readability and it can help when debugging things.
// iVariable = integer
// szVariable = string
// fVariable = float

//new szMenu;
new iMenu;

public 
plugin_init() 
{
    
register_pluginPLUGIN VERSION AUTHOR );
    
    
RegisterHamHam_Killed "player" "PostPlayerKilled" );
    
    
iMenu menu_create"\w[\rBB\w]\y Respawn?" "RespawnHandler" );
    
menu_additemiMenu "\wYes" );
    
menu_additemiMenu "\wNo" );
    
menu_setpropiMenu MPROP_NUMBER_COLOR "\r" );
}

public 
PostPlayerKillediVictim iAttacker iShouldGib )
{
    
//** You shouldn't need to check for team here since only a T or CT can be killed..and it's not possible
    //** for a player to change to spectator between the time he is killed and when Ham_Killed post is executed.
    
    //** No need to check that a player is not alive since this is called Ham_Killed post, the player is 
    //** definitely going to be dead.
    
    /*
    iTeam = get_user_team(iVictim);
    if(!is_user_alive(iVictim) && (iTeam == 1 || iTeam == 2))
    {
        menu_display(iVictim, szMenu)
    }*/
    
    
menu_displayiVictim iMenu );
}

public 
RespawnHandlerid iMenuID item )
{    
    
//** You should do the team and alive checking when the user makes a menu selection. This way, if
    //** the menu is still up when a new round starts (and he is spawned naturally), you would not want 
    //** to allow him to re-spawn via the menu. Ideally you should force-close the menu on new round.
    
    //** Use cs_get_user_team() native for cstrike
    
    /*iTeam = get_user_team(id);
    if(!is_user_alive(id) && (iTeam == 1 || iTeam == 2))
    {
        ** No need for a switch for only 1 item. Just have an if statement for menu item 0..
        switch(item)
        {
            case 0: ExecuteHamB(Ham_CS_RoundRespawn, id);
            case 1: return PLUGIN_HANDLED;
        }
    }
    return PLUGIN_HANDLED*/
    
    
if ( item == )
    {
        if ( !
is_user_aliveid ) && ( CS_TEAM_T <= cs_get_user_teamid ) <= CS_TEAM_CT ) )
        {
            
ExecuteHamBHam_CS_RoundRespawn id );
        }
    }

    return 
PLUGIN_HANDLED;

__________________

Last edited by Bugsy; 04-04-2020 at 13:27.
Bugsy is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-04-2020 , 13:54   Re: Need respawn plugin that asks if u want to respawn
Reply With Quote #6

@bugsy is `menu_destroy( menu )` necesarry to use when closing the menu? i heard without it the leak of memory is possible to be made, or smth like that
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-04-2020 , 14:01   Re: Need respawn plugin that asks if u want to respawn
Reply With Quote #7

In this case, no, since the same menu is being re-used over and over again. If you were creating a fresh menu each time, then I think it would be appropriate.
__________________
Bugsy is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-04-2020 , 15:09   Re: Need respawn plugin that asks if u want to respawn
Reply With Quote #8

nice to know, thanks
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-04-2020 , 17:49   Re: Need respawn plugin that asks if u want to respawn
Reply With Quote #9

Thanks for clearing some things up Bugsy.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Reply


Thread Tools
Display Modes

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 08:55.


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