View Single Post
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