Raised This Month: $218 Target: $400
 54% 

Advanced - Respawn || [15/4/2008]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 03-01-2008 , 20:33   Advanced - Respawn || [15/4/2008]
Reply With Quote #1

PHP Code:
/***********************************************************************************
*                                            
*              Plugin : Advanced - Respawn Menu    
*                                            
*                      Author : Atomen                        
*                                            
*                Version : 2.1 - 15/4/2008
*
*    Plugin Thread : "http://forums.alliedmods.net/showthread.php?t=67801"
*        
*===================================================================================*
*
*                        Description
*    
* My first plugin , Advanced respawn with menu. Has multiple different features.
* Instant respawn on join (defined by cvar). Health on spawn feature
* 17 cvars and more to come to customize. Only works on Counter-Strike and CZ.
* Requires 4 modules , "fakemeta_util", "hamsandwich", "cstrike", "fakemeta".
*
* Advanced menu for each cvar. Also blocks
* abusing of "/respawn" say command. You cannot use it while alive. I made this
* plugin mostly because the were only 2 different respawn plugins out there.
* (This does not count as a deathmatch plugin)                    
*                                            
* Halo - Respawn : Made by Emp`    (Though it differs much from this plugin)
*                                            
* Respawn Forever : Made by Geesu                            
*
* Last update on "Halo - Respawn" was on 4/2/2007.    
* Last update on "Respawn Forever" was on 2/4/2005.
*                    
* This plugin is using pcvar and new respawn system "Hamsandwich"
*                                            
*==================================================================================*
*
*                   Credits                
*
*         -Exolent : Recived a much needed help from him !
*
*         -Arkshine : Pointing out that i should use if statement
*
*         -G-Dog : Helped me with multiple "cs_get_user_team" command
*
*         -v3x : Got help from his plugin "Awp Glow"
*
*         -Geesu : Used his code for the "/respawn" command
*
*         -MeRcyLeZZ : Helped me alot with the menus !
*
*         -[FTW]-S.W.A.T / vittu : Code for the spawn effect
*
*         -Vittu : Ham respawn function and recommending other team function
*
*==================================================================================*
*                                            
* Changelog :
* V 2.1 - Addition Update
* - Fixed menu comes up when plugin is disabled
* - Fixed message displayed even if dead
* - Fixed problem with server cvar
* - Added amx_respawn_punish cvar/menu
* - Added amx_respawn_click cvar/menu
* - Added additional checks on spawn
* - Changed Admin flag to "u" for menu access
* - Changed position of the hudmessages
* - Changed chat detecting
*
* V 2.0 - Performance Update
* - Improved performance/stability
* - Added a lot more use of hamsandwich module
* - Added block for the say command
* - Added more checks to avoid problems
* - Renamed some functions to more appropriate names
* - Removed a lot of "not needed" functions
* - Removed not needed variables
* - Removed all bugs/problems
* - Fixed a crash whom occured on respawn
* - Fixed a pcvar problem with toggle_say
* - Fixed so less resources is used
* - Fixed amx_respawn_armor menu
* - Fixed code smaller
* - Changed the spawn effect framerate
* - Changed some commands/functions
* - Changed a lot of checks
*
* V 1.5c - Update || 10/3/2008
* - Fixed Crash problem
* - Added Plugin Tracker
* - Added *_kill_money cvar/menu
*
* V 1.5b - Small addition
* - Added more options for *_abuse
*
* V 1.5a - Bug/Problem Update
* - Fixed issue with money system
* - Fixed 3 bugs/problems
* - Fixed "/respawn"
* - Added cstrike module for better detecting
*
* V 1.5 - Never released
* - An important update on the menus !
* - Reduced numbers of "set_task()"
* - Fixed problems with menus
* - Added money system, off by default
* - Added amx_respawn_money cvar/menu
* - Added amx_respawn_amount cvar/menu
* - Added fakemeta module for respawn support
*
* V 1.4 - Important Update
* - Changed respawn method to hamsandwich
* - Fixed Weapon related Menu
* - Added amx_respawn_health cvar/menu
* - Renamed amx_respawn_say to *_abuse
*
* V 1.3a - Small Update
* - Added amx_respawn_say cvar/menu
*
* V 1.3
* - Removed fun module
* - Renamed main menu
* - Added sound effect on spawn
* - Added amx_respawn_effect cvar/menu
* - Added amx_respawn_armor cvar/menu
*    
* V 1.2
* - Optimized code
*
* V 1.1
* - Removed cstrike module thanks to X-Olent
*
* V 1.0
* - Initial release
*
*==================================================================================*
*                                            
*                Menu Command :                        
*                                            
*               amx_respawn_menu                        
*                                            
*            Write in console, Requires                    
*               ADMIN_MENU access (flag "u")   
*                                            
*                                            
************************************************************************************
*                                            
*    CVARS Spawn Related :                                
*                                            
*    amx_respawn       "1"       //Toggles the plugin on/off            
*    amx_respawn_delay  "1"       //Delay until respawn upon death
*    amx_respawn_effect "0"       //Respawn effect    
*    amx_respawn_abuse  "1"       //0=Disabled 1=only dead 2=Say "/respawn" alive
*    amx_respawn_health "0"       //Health on spawn , 0 = 100 hp
*    amx_respawn_click  "0"       //Respawn by click(+attack)
*                                            
*                                            
************************************************************************************
*                                            
*    CVARS Protection Related :                            
*                                            
*    amx_respawn_protection         "1"    //Toggles spawn protection on/off        
*    amx_respawn_protection_time    "3"    //Toggles how long you are protected        
*    amx_respawn_protection_glow    "1"    //Toggles Protection Glow            
*    amx_respawn_protection_message "1"    //Toggles spawn protection message on/off
*                                            
*                
************************************************************************************
*                                            
*    CVARS Weapon Related :                                
*                                                
*    amx_respawn_pistol "1"        //Respawn with a pistol or not            
*    amx_respawn_ammo   "1"        //Respawn with full ammo on the pistol     
*    amx_respawn_kevlar "1"        //Respawn with kevlar= 1 ||Kevlar+Helmet = 2
*    amx_respawn_punish "0"        //Remove the users weapon on tk
*                                            
*                                            
************************************************************************************
*                                            
*    CVARS Money Related :                                
*                                                
*    amx_respawn_money      "1"    //Recieve money on each respawn,0 by default
*    amx_respawn_amount     "600"    //How much money , 600 by default
*    amx_respawn_kill_money "200"    //Add money on frag, Default 300 + "200"
*                                            
*                                            
***********************************************************************************/ 
Recommended Addons :Updates : Current Version 2.1 - Update || 15/4/2008
Code:
* Changelog :
* V 2.1
* - Fixed menu comes up when plugin is disabled
* - Fixed message displayed even if dead
* - Fixed problem with server cvar
* - Added amx_respawn_punish cvar/menu
* - Added amx_respawn_click cvar/menu
* - Added additional checks on spawn
* - Changed Admin flag to "u" for menu access
* - Changed position of the hudmessages
* - Changed chat detecting
*
* V 2.0 - Performance Update
* - Improved performance/stability
* - Added a lot more use of hamsandwich module
* - Added block for the say command
* - Added more checks to avoid problems
* - Renamed some functions to more appropriate names
* - Removed a lot of "not needed" functions
* - Removed not needed variables
* - Removed all bugs/problems
* - Fixed a crash whom occured on respawn
* - Fixed a pcvar problem with toggle_say
* - Fixed so less resources is used
* - Fixed amx_respawn_armor menu
* - Fixed code smaller
* - Changed the spawn effect framerate
* - Changed some commands/functions
* - Changed a lot of checks
In version 2.1 i added a cvar amx_respawn_click, you
should try it out.

There are 2 different versions of the plugin.
With or without menu.

Uploaded both because the 1 with menus has a lot of more lines.
-----------------------------------------

If you have a lot of menus you can fix it easily.
Just add this menu to amxmodmenu with this command
Code:
amx_addmenuitem "Respawn Menu" "amx_respawn_menu" "c" "Advanced - Respawn Menu"
Add it to the custom menu file in "amxmodx/configs/custommenuitems.cfg"

NOTE : Since "/respawn" is often abused ive used a "protection"
to stop the abuse. If you type "/respawn" you will be teleported to
the spawn. So your hp will not get refilled or your weapons

"amx_respawn_abuse '0'" = No messages , Say Command off
"amx_respawn_abuse '1'" = Only dead players can use it(default)
"amx_respawn_abuse '2'" = Alive and dead can use it.

Screenshot on the menu
Attached Files
File Type: sma Get Plugin or Get Source (advanced_respawn.sma - 9283 views - 19.0 KB)
File Type: sma Get Plugin or Get Source (advanced_respawn_menu.sma - 6317 views - 58.6 KB)
__________________

Last edited by atomen; 08-21-2008 at 06:24.
atomen is offline
Send a message via MSN to atomen
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-01-2008 , 21:03   Re: Advanced - Respawn
Reply With Quote #2

you can remove cstrike and fun module by changing the following:
Code:
give_item()
cs_get_user_team()
strip_user_weapons()
to
Code:
fm_give_item()
get_user_team() // 0 for unassigned, 1 for terrorist, 2 for ct, 3 for spectator
fm_strip_user_weapons()
also, there can be a lot of optimization for your plugin
look here
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 03-01-2008 , 21:16   Re: Advanced - Respawn
Reply With Quote #3

Thanks X-Olent =D
Though i still need fun module for godmode and render.
__________________
atomen is offline
Send a message via MSN to atomen
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 03-01-2008 , 22:49   Re: Advanced - Respawn
Reply With Quote #4

Quote:
Originally Posted by X-olent View Post
you can remove cstrike and fun module by changing the following:
Code:
give_item()
cs_get_user_team()
strip_user_weapons()
to
Code:
fm_give_item()
get_user_team() // 0 for unassigned, 1 for terrorist, 2 for ct, 3 for spectator
fm_strip_user_weapons()
also, there can be a lot of optimization for your plugin
look here
get_user_team is not as reliable as cs_get_user_team() and most will have cstrike on anyway.

And using fakemeta_util will confuse those that do not understand they need the 3party include to compile. Be easier and better to spawn them with hamsandwich (no need for double spawn and default weapons are given).
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 03-01-2008 , 23:33   Re: Advanced - Respawn
Reply With Quote #5

get rid of fun.

pev_takedammage 0.0
there is an fm solution for render.
Styles is offline
Send a message via AIM to Styles Send a message via MSN to Styles
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-01-2008 , 23:53   Re: Advanced - Respawn
Reply With Quote #6

these functions are in fakemeta_util.inc

Code:
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) {
    new Float:RenderColor[3]
    RenderColor[0] = float(r)
    RenderColor[1] = float(g)
    RenderColor[2] = float(b)

    set_pev(entity, pev_renderfx, fx)
    set_pev(entity, pev_rendercolor, RenderColor)
    set_pev(entity, pev_rendermode, render)
    set_pev(entity, pev_renderamt, float(amount))

    return 1
}

stock fm_get_user_godmode(index) {
    new Float:val
    pev(index, pev_takedamage, val)

    return (val == DAMAGE_NO)
}

stock fm_set_user_godmode(index, godmode = 0) {
    set_pev(index, pev_takedamage, godmode == 1 ? DAMAGE_NO : DAMAGE_AIM)

    return 1
}
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
necox
Member
Join Date: Feb 2008
Old 03-02-2008 , 03:34   Re: Advanced - Respawn
Reply With Quote #7

thnx nice plugin
__________________
necox is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 03-02-2008 , 07:48   Re: Advanced - Respawn
Reply With Quote #8

Thanks !
I will upload new version , But i want to change spawn function.

With hamsandiwch should i use "ham_respawn" or "ham_spawn"
__________________
atomen is offline
Send a message via MSN to atomen
Old 03-02-2008, 11:26
fxfighter
This message has been deleted by fxfighter.
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-02-2008 , 14:42   Re: Advanced - Respawn
Reply With Quote #9

Code:
ExecuteHam(Ham_Spawn, iVictimID);
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 03-02-2008 , 14:48   Re: Advanced - Respawn
Reply With Quote #10

Thanks ;D
But it don't think i will use it because of what fxfighter said.

EDIT : v1.3 is soon finished
__________________

Last edited by atomen; 03-02-2008 at 14:48. Reason: Forgot to tell.
atomen is offline
Send a message via MSN to atomen
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 20:29.


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