Raised This Month: $ Target: $400
 0% 

Potti Bot Doesn't Respawn Where He Died


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
enjoi.
Veteran Member
Join Date: Mar 2011
Old 07-26-2014 , 05:48   Potti Bot Doesn't Respawn Where He Died
Reply With Quote #1

Code:
#include <amxmodx>
#include <engine>
#include <hamsandwich>

new gSetSpawnOrigin;
#define ShouldSetSpawnOrigin(%1) (gSetSpawnOrigin &   (1 << (%1 & 31)))
#define SetSpawnOrigin(%1)        gSetSpawnOrigin |=  (1 << (%1 & 31))
#define ClearSpawnOrigin(%1)      gSetSpawnOrigin &= ~(1 << (%1 & 31))

#define MAX_PLAYERS 32

new Float:gSpawnOrigin[MAX_PLAYERS + 1][3];

public plugin_init() {
    register_plugin("Respawn Position", "0.0.1", "Exolent");
    
    RegisterHam(Ham_Killed, "player", "FwdPlayerKilled");
    RegisterHam(Ham_Killed, "player", "FwdPlayerKilledPost", 1);
    RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawnPost", 1);
}

public client_disconnect(id) {
    ClearSpawnOrigin(id);
}

public FwdPlayerKilled(victim, killer, shouldGib) {
    entity_get_vector(victim, EV_VEC_origin, gSpawnOrigin[victim]);
    SetSpawnOrigin(victim);
}

public FwdPlayerKilledPost(victim, killer, shouldGib) {
    entity_set_int(victim, EV_INT_deadflag, DEAD_RESPAWNABLE);
    entity_set_float(victim, EV_FL_nextthink, get_gametime());
}

public FwdPlayerSpawnPost(id) {
    if(ShouldSetSpawnOrigin(id) && is_user_alive(id)) {
        entity_set_vector(id, EV_VEC_origin, gSpawnOrigin[id]);
        
        ClearSpawnOrigin(id);
    }
}
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]
enjoi. is offline
 



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 13:13.


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