I used the code of two plugins forum here to make a plugin to revive with a limit of uses, but when you get error compiles, what did I do wrong?
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
new g_spawn_mode, g_spawn_max
new bool:g_canspawn[33], g_used[33]
new Float:g_spawns[33][3], Float:g_angles[33][3]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("dr_extra_sPawn",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
g_ztele_mode = register_cvar("dr_extra_spawn_mode", "0") // 0 - both teams, 1 - humans, 2 - zombies
g_ztele_max = register_cvar("dr_extra_spawn_max", "3") // how many times you can use ztele
register_clcmd("say /spawn", "CmdSpawn");
register_clcmd("say !spawn", "CmdSpawn");
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn", 1)
}
public client_connect(id)
{
g_used[id] = 0
g_canztele[id] = false
}
public client_disconnect(id)
{
g_used[id] = 0
g_canztele[id] = false
}
public fw_PlayerSpawn(id)
{
if (!is_user_alive(id))
return HAM_IGNORED
g_canztele[id] = false
pev(id, pev_origin, g_spawns[id])
pev(id, pev_angles, g_angles[id])
client_print(id, print_chat, "[Deathrun] este server está rodando drspawn by Rodrigo286, use !spawn para renascer")
return HAM_IGNORED
}
public CmdSpawn(id)
{
if (!is_user_alive(id))
{
g_used[id] = 0
g_canspawn[id] = false
client_print(id, print_chat, "[Deathrun] voce precisa estar morto para usar !spawn")
return PLUGIN_HANDLED
}
switch (get_pcvar_num(g_spawn_mode))
{
case 1:
{
if (zp_get_user_human(id))
{
teleport_player(id)
client_print(id, print_chat, "[Deathrun] Voce foi revido para seu spawn.")
client_print(id, print_chat, "[Deathrun] Voce reviveu %d de %d vezes", get_pcvar_num(g_spawn_max))
}
}
}
if (get_pcvar_num(g_spawn_max) == g_used[id])
{
g_canspawn[id] = false
client_print(id, print_chat, "[Deathrun] Voce nao pode reviver novamente voce usou %d de %d vezes", get_pcvar_num(g_spawn_max))
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public CmdSpawn(id)
ExecuteHamB(Ham_CS_RoundRespawn, id);
}
stock teleport_player(id)
{
g_used[id]++
set_pev(id,pev_origin, g_spawns[id])
set_pev(id, pev_angles, g_angles[id])
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(Ham_CS_RoundRespawn)
engfunc(EngFunc_WriteCoord, g_spawns[id][0])
engfunc(EngFunc_WriteCoord, g_spawns[id][1])
engfunc(EngFunc_WriteCoord, g_spawns[id][2])
message_end()
}
error:
[IMG]http://img808.**************/img808/8361/plugin.png[/IMG]
Thanks!