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

Ghost Respawning 1.1


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff        Approver:   VEN (29)
mateo10
Veteran Member
Join Date: Jan 2006
Old 04-04-2007 , 08:41   Ghost Respawning 1.1
Reply With Quote #1

Ghost Respawning
[Updated 30th June 2009]


Description
Buy a respawn stone by typing /buystone in chat. If you have a stone, you will get respawned as a ghost (transparent) at the place you died.

Cvars
  • ghost_enable <1|0>
    • Enables or disables the plugin.
  • ghost_cost <money>
    • The cost of the stone (default 10000).
  • ghost_health <health>
    • Health when the player is a ghost (default 50).


Commands
  • say /buystone
    • Buys a respawn stone.

Requirements
  • AMX Mod X 1.80 or higher.
  • Fakemeta
  • Ham Sandwich
  • Cstrike

Changelog
Code:
 ******
 * Changelog
 *  1.1
 *	[FIXED] Total rewrite, using Ham Sandwich for
 *		events, fakemeta instead of fun.
 *		Cleaned up code.
 *  1.05
 *	[FIXED] Took away the (id) from event_new_round.
 *		You must download the new version in order
 *		to get the plugin to work.
 *
 *  1.04
 *	[FIXED] Moved the reset of rendering to the new round event.
 *	[FIXED] Now it only resets rendering on previous ghosts.
 *
 *  1.03
 *	[ADDED] Added that the player have to be in buyzone to buy
 *		the respawn stone.
 *	[FIXED] Fixed the set_task.
 *
 *  1.02
 *	[FIXED] The message "type /buystone"... comes at new round
 *		instead of round start now.
 *	[FIXED] Fixed that more than one person can die without
 *		respawning at the same place as the one before.
 *
 *  1.01
 *	[FIXED] Quick fix: The rendering will stop at round end.
 *
 *  1.0
 *	[RELEASE] Plugin released.
 *******
Credits
Attached Files
File Type: sma Get Plugin or Get Source (ghost.sma - 3214 views - 4.6 KB)

Last edited by mateo10; 07-01-2009 at 09:29.
mateo10 is offline
JVC
BANNED
Join Date: Apr 2007
Location: Indiana
Old 04-04-2007 , 10:13   Re: Ghost Respawning
Reply With Quote #2

Excellent plugin I love the idea, good job.
JVC is offline
Deviance
Veteran Member
Join Date: Nov 2004
Location: Sweden
Old 04-04-2007 , 10:28   Re: Ghost Respawning
Reply With Quote #3

Code:
public event_deathmsg() {     if(get_pcvar_num(GhostEnable)) {         new victim = read_data(2);             if(GhostStones[victim] && is_user_connected(victim)) {             get_user_origin(victim, Origin);             new parm[1];             parm[0] = victim;             set_task(3.0, "ghost_player", 72, parm[0], 1);                     GhostStones[victim]--;         }     } }

Let's make an example: Player 1 get's killed by Player 2 and Player 1 have a Stone, now the Origin array have he's origin, but 2 sec's later Player 2 get's killed by Player 3. Now the Origin array is filled whit Player 2's origin.

See the hook? Now when Player 1 get's spawned he will be placed where Player 2 died. I dunno if the plugin is ment to do like this but i was quite sure it wasen't.
Deviance is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 04-04-2007 , 16:03   Re: Ghost Respawning
Reply With Quote #4

You're right, but I don't really know how to fix it. I messed around with it a bit, but the fact that i need a set_task is complicating the parameters after id.

If I do like this:
Code:
new Origin[3]; get_user_origin(id, Origin);
in the event_deathmsg function I don't know how to make the set_task work.

Thanks in advance,
MaTTe
mateo10 is offline
Deviance
Veteran Member
Join Date: Nov 2004
Location: Sweden
Old 04-04-2007 , 16:10   Re: Ghost Respawning
Reply With Quote #5

You can do like this

Code:
#include <amxmodx> #include <cstrike> #include <fun> new GhostEnable; new GhostCost; new GhostHealth; new Origin[33][3]; new GhostStones[33]; public plugin_init() {     register_plugin("Ghost Respawning", "1.01", "MaTTe");         GhostEnable = register_cvar("ghost_enable", "1");     GhostCost = register_cvar("ghost_cost", "10000");     GhostHealth = register_cvar("ghost_health", "50");         register_event("DeathMsg", "event_deathmsg", "a");     register_logevent("logevent_round_start", 2, "1=Round_Start");     register_logevent("logevent_round_end", 2, "1=Round_End");         register_clcmd("say /buystone", "cmdBuystone"); } public logevent_round_end() {     new players[32], num;     get_players(players, num);     new player;     for(new i=0;i<num;i++) {         player = players[i];         set_user_rendering(player, kRenderFxNone, 255, 255, 255, kRenderNormal, 255);     } } public logevent_round_start()     client_print(0, print_chat, "[Ghost Respawning] Type /buystone to buy a respawn stone."); public event_deathmsg() {     if(get_pcvar_num(GhostEnable)) {         new victim = read_data(2);             if(GhostStones[victim] && is_user_connected(victim)) {             get_user_origin(victim, Origin[victim]);             new parm[1];             parm[0] = victim;             set_task(3.0, "ghost_player", 72, parm[0], 1);                     GhostStones[victim]--;         }     } } public cmdBuystone(id) {     if(!get_pcvar_num(GhostEnable))         return PLUGIN_HANDLED;             if(!is_user_alive(id) || !is_user_connected(id))         return PLUGIN_HANDLED;         new Money = cs_get_user_money(id);     new Cost = get_pcvar_num(GhostCost);         if(Money < Cost) {         client_print(id, print_chat, "[Ghost Respawning] You do not have enough money to buy the respawn stone.");         return PLUGIN_HANDLED;     }         cs_set_user_money(id, Money - Cost);     GhostStones[id]++;         client_print(id, print_chat, "[Ghost Respawning] Respawn stone succefully bought. (%d in backpack)", GhostStones[id]);         return PLUGIN_HANDLED; } public ghost_player(parm[1]) {     spawn(parm[0]);     Origin[parm[0]][2] += 20;     set_user_origin(parm[0], Origin[parm[0]]);     set_user_rendering(parm[0], kRenderFxNone, 255, 255, 255, kRenderGlow, 40);     set_user_health(parm[0], get_pcvar_num(GhostHealth)); }

Also if you want i can help you some more, just add me on MSN if you want.

Last edited by Deviance; 04-04-2007 at 16:16.
Deviance is offline
Old 04-04-2007, 16:10
mateo10
This message has been deleted by mateo10. Reason: Didn't see your post
VEN
Veteran Member
Join Date: Jan 2005
Old 04-05-2007 , 08:11   Re: Ghost Respawning
Reply With Quote #6

Quote:
public logevent_round_start()
client_print(0, print_chat, "[Ghost Respawning] Type /buystone to buy a respawn stone.");
This should be almost pointless to type this on freezetime end when most of players has already completed buying. Better print this on new round, more info: http://forums.alliedmods.net/showthread.php?t=42159
VEN is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 04-05-2007 , 08:26   Re: Ghost Respawning
Reply With Quote #7

Thanks for the hint. Changed.
mateo10 is offline
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 04-06-2007 , 09:30   Re: Ghost Respawning 1.03
Reply With Quote #8

Nice job mateo.
__________________
i stop around here and there.
Da_sk8rboy is offline
Dark Kingdom
BANNED
Join Date: Apr 2007
Location: VT
Old 04-06-2007 , 11:22   Re: Ghost Respawning 1.03
Reply With Quote #9

tested and works also good job!
Dark Kingdom is offline
HardCoded...
Member
Join Date: Mar 2007
Location: ^^ !Venom Fan! ^^ CA, Fr
Old 04-06-2007 , 16:13   Re: Ghost Respawning 1.03
Reply With Quote #10

does this have any effects? meaning by your invisible or glow blue or anything like that during respawning in ghost mode.
HardCoded... is offline
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 16:26.


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