Post by ShaunCraft15 on Jul 3, 2023 16:15:50 GMT
Hi this is respawn system for only who connect to server
here the source code of the plugin
ZP50:
ZP43:
if there is bugs in zp43 version just tell me and ill try to fix this and thanks
here the source code of the plugin
ZP50:
#include <amxmodx>
#include <hamsandwich>
#include <zp50_gamemodes>
#include <zp50_core>
const TASK_RESPAWN = 100
new fPcvarDeathMatch, fPcvarRespawnDelay
public plugin_init()
{
register_plugin("[ZP] Respawn System", "1.0", "ShaunCraft")
fPcvarDeathMatch = get_cvar_pointer("zp_deathmatch")
fPcvarRespawnDelay = get_cvar_pointer("zp_respawn_delay")
}
public client_putinserver(this)
if(!is_user_alive(this) && is_user_connected(this)) // Works for no alive players
if(CheckGamemodes()) // Ony worked with infection round (by default)
if(get_pcvar_num(fPcvarDeathMatch)) // If "zp_deathmatch" cvar enabled
set_task(get_pcvar_float(fPcvarRespawnDelay), "RespawnPlayer", this+TASK_RESPAWN) // Set Respawn Task
public RespawnPlayer(fTaskID)
{
new this = fTaskID - TASK_RESPAWN
// Respawn The Player (because zp_core_respawn_as_zombie doesn't work idk why?)
ExecuteHamB(Ham_CS_RoundRespawn, this)
// Infect Player if "zp_deathmatch" is 2
if(get_pcvar_num(fPcvarDeathMatch) == 2)
zp_core_infect(this, this)
}
CheckGamemodes()
{
// Increase this fModes[num] if you want other supported modes
new fModes[3]
fModes[0] = zp_gamemodes_get_current()
fModes[1] = zp_gamemodes_get_id("Infection Mode")
fModes[2] = zp_gamemodes_get_id("Multiple Infection Mode")
// I use fNum = 1 to skip the gamemodes check
for(new fNum = 1; fNum <= charsmax(fModes); fNum++)
{
// If current mode is what we need
if(fModes[0] == fModes[fNum])
return true;
}
return false;
}
ZP43:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
const TASK_RESPAWN = 100
new fPcvarDeathMatch, fPcvarRespawnDelay
public plugin_init()
{
register_plugin("[ZP] Respawn System", "1.0", "ShaunCraft")
fPcvarDeathMatch = get_cvar_pointer("zp_deathmatch")
fPcvarRespawnDelay = get_cvar_pointer("zp_respawn_delay")
}
public client_putinserver(this)
if(!is_user_alive(this) && is_user_connected(this)) // Works for no alive players
if(CheckGamemodes()) // Ony worked with infection round (by default)
if(get_pcvar_num(fPcvarDeathMatch)) // If "zp_deathmatch" cvar enabled
set_task(get_pcvar_float(fPcvarRespawnDelay), "RespawnPlayer", this+TASK_RESPAWN) // Set Respawn Task
public RespawnPlayer(fTaskID)
{
new this = fTaskID - TASK_RESPAWN
// Respawn The Player (because zp_core_respawn_as_zombie doesn't work idk why?)
ExecuteHamB(Ham_CS_RoundRespawn, this)
// Infect Player if "zp_deathmatch" is 2
if(get_pcvar_num(fPcvarDeathMatch) == 2)
zp_infect_user(this, this)
}
CheckGamemodes()
{
if(zp_has_round_started())
{
// Add the zp_is_.._round native because my zombieplague include is modified too much
if(zp_is_nemesis_round() || zp_is_swarm_round() || zp_is_swarm_round())
return false;
}
return true;
}
if there is bugs in zp43 version just tell me and ill try to fix this and thanks