PDA

View Full Version : onspawn function?


delop
04-05-2008, 17:57
#include <amxmodx>

#define PLUGIN "Life System"
#define VERSION "1.0"
#define AUTHOR "Lucky"

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
}
public client_spawn(id){
new deaths = get_user_deaths(id)
if (deaths >= 1){
if(get_user_team(id) == 1){
if(is_user_alive(id)){
console_print(id,"[ZOMBIE] You are out of lives!")
user_kill(id)

client_cmd(id,"say No more lives, wait till the round ends (default: 10 mins)")
PLUGIN_HANDLED;
}
}
}
PLUGIN_HANDLED;
}

It doesn't kill the player.. this is for ts3.0 btw

v3x
04-05-2008, 18:41
Try using the Ham Sandwich module:

#include <amxmodx>
#include <hamsandwich>

public plugin_init()
{
RegisterHam(Ham_Spawn, "player", "Ham_PlayerSpawn");
}

public Ham_PlayerSpawn(id)
{
user_kill(id, 1);
// ...
}

delop
04-05-2008, 19:53
Ham Sandwich module isn't supported by TS3?

v3x
04-05-2008, 20:27
It isn't? Sorry, I didn't know.

Try using the ResetHUD event then. It's not the best because it's called 3 times (at least in CS it is) but it should work.

Exolent[jNr]
04-05-2008, 21:02
old way without any extra modules
new bool:g_bRestartAttempt[33];

public plugin_init()
{
register_event("TextMsg", "event_RestartAttempt", "a", "2=#Game_will_restart_in");
register_clcmd("fullupdate", "clcmd_fullupdate");
register_event("ResetHUD", "event_ResetHUD", "be");
}

public event_RestartAttempt()
{
new players[32], pnum;
get_players(players, pnum, "a");
for(new i = 0; i < pnum; i++)
{
g_bRestartAttempt[players[i]] = true;
}
}

public clcmd_fullupdate(id)
{
return PLUGIN_HANDLED_MAIN;
}

public event_ResetHUD(id)
{
if(g_bRestartAttempt[id])
{
g_bRestartAttempt[id] = false;
return;
}
event_PlayerSpawn(id);
}

public event_PlayerSpawn(id)
{
// called on player spawn
}

or hamsandwich
public plugin_init()
{
RegisterHam(Ham_Spawn, "player", "fwd_Ham_Spawn");
}

public fwd_Ham_Spawn(id)
{
// called on player spawn
}

delop
04-05-2008, 23:45
None of them work. I don't think it's possible though

thanks for trying :)

hazard1337
04-05-2008, 23:57
couldnt you link it to do amx_slay on someone?
edit:Oh, try user_kill(id, 0)