AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Ghost Respawning 1.1 (https://forums.alliedmods.net/showthread.php?t=53470)

mateo10 04-04-2007 08:41

Ghost Respawning 1.1
 
13 Attachment(s)
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

JVC 04-04-2007 10:13

Re: Ghost Respawning
 
Excellent plugin I love the idea, good job.

Deviance 04-04-2007 10:28

Re: Ghost Respawning
 
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.

mateo10 04-04-2007 16:03

Re: Ghost Respawning
 
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

Deviance 04-04-2007 16:10

Re: Ghost Respawning
 
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.

VEN 04-05-2007 08:11

Re: Ghost Respawning
 
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

mateo10 04-05-2007 08:26

Re: Ghost Respawning
 
Thanks for the hint. Changed.

Da_sk8rboy 04-06-2007 09:30

Re: Ghost Respawning 1.03
 
Nice job mateo.

Dark Kingdom 04-06-2007 11:22

Re: Ghost Respawning 1.03
 
tested and works also good job!

HardCoded... 04-06-2007 16:13

Re: Ghost Respawning 1.03
 
does this have any effects? meaning by your invisible or glow blue or anything like that during respawning in ghost mode.


All times are GMT -4. The time now is 01:08.

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