AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Potti Bot Doesn't Respawn Where He Died (https://forums.alliedmods.net/showthread.php?t=244952)

enjoi. 07-26-2014 05:48

Potti Bot Doesn't Respawn Where He Died
 
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);
    }
}


Phant 07-26-2014 06:08

Re: Potti Bot Doesn't Respawn Where He Died
 
For respawn Potti, better to edit source (SMA) file of Potti plugin.
PHP Code:

ExecuteHamB(Ham_CS_RoundRespawnid


enjoi. 07-26-2014 06:13

Re: Potti Bot Doesn't Respawn Where He Died
 
Quote:

Originally Posted by Phant (Post 2174080)
For respawn Potti, better to edit source (SMA) file of Potti plugin.
PHP Code:

ExecuteHamB(Ham_CS_RoundRespawnid


Tell you the truth, i don't know where to add that, i am a noob at coding.


All times are GMT -4. The time now is 10:11.

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