I have a plugin which isn't good, and wont be released here (it stinks)
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <fakemeta>
#include <cstrike>
#define PLUGIN "Respawn"
#define VERSION "1.0"
#define AUTHOR "Throstur"
//new g_pMessage
new g_pTrucker
new g_pMoney
new g_pWeapon
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
//Messages
// g_pMessage = register_cvar("amx_respawn_pussy","[AMXX] Pussy.")
g_pTrucker = register_cvar("amx_respawn_trucker","[AMXX] Keep on truckin'.")
g_pMoney = register_cvar("amx_respawn_money","1000")
g_pWeapon = register_cvar("amx_respawn_weapon","glock")
register_cvar("amx_respawn_weapon_on","1")
//Respawn
register_cvar("amx_respawn","1")
register_event("DeathMsg","fnEventDeathMsg","a")
register_clcmd("say /respawn","fnCmdRespawn")
set_task(2.0,"fnCheckDeadPlayers",_,_,_,"b")
}
public fnCmdRespawn(id)
{
new CsTeams:cstTeam = cs_get_user_team(id)
if(!get_cvar_num("amx_respawn"))
{
client_print(id,print_chat,"[AMXX] Respawning is currently disabled.")
return PLUGIN_CONTINUE
}
if(cstTeam == CS_TEAM_T || cstTeam == CS_TEAM_CT)
set_task(0.5,"fnSpawn",id)
else
{
client_print(id,print_chat,"[AMXX] You must be on a team to respawn.")
return PLUGIN_CONTINUE
}
if(is_user_alive(id))
{
// new szMessage[33]
// get_pcvar_string(g_pMessage,szMessage,32)
// client_print(id,print_chat,"%s",szMessage)
client_print(id,print_chat,"[AMXX] Your momma would be ashamed of you.")
}
else
{
// new szTrucker[33]
// get_pcvar_string(g_pTrucker,szTrucker,32)
// client_print(id,print_chat,"%s",szTrucker)
// client_print(id,print_chat,"[AMXX] Keep on truckin'.")
}
return PLUGIN_CONTINUE
}
public fnCheckDeadPlayers()
{
new iPlayers[32],iPlayersnum
get_players(iPlayers,iPlayersnum,"b")
for(new iCount = 0;iCount < iPlayersnum;iCount++)
fnSpawn(iPlayers[iCount])
}
public fnEventDeathMsg()
set_task(0.5,"fnSpawn",read_data(2))
public fnSpawn(id)
{
if(is_user_connected(id) && (cs_get_user_team(id) == CS_TEAM_T || cs_get_user_team(id) == CS_TEAM_CT) && get_cvar_num("amx_respawn"))
cs_user_spawn(id)
new szTrucker[33]
get_pcvar_string(g_pTrucker,szTrucker,32)
client_print(id,print_chat,"%s",szTrucker)
new money = get_pcvar_num(g_pMoney)
cs_set_user_money(id,clamp(cs_get_user_money(id) + money,0,16000))
if(get_cvar_num("amx_respawn_weapon_on"))
{
new szWeapon[33]
get_pcvar_string(g_pWeapon,szWeapon,32)
format(szWeapon,32,"weapon_%s",szWeapon)
give_item(id,szWeapon)
}
}
do is give the player the money defined by money (works) and the gun defined by gun (I dont think this works, didnt work for "glock", name might be wrong but double check code because it looks fine to me.) and the player should be spawned instantly.
A bug I am getting is that the player sometimes leaves behind a leftover, passable player model on respawn, kind of annoying. The /say respawn feature is just there for developement reasons and doesnt even need to be there...