2day had a member a good idea for a new deathmatch plugin and i tried to check how is the idea in game.
its funny and i think this could be a good gameplay plugin.
i have no time to write the code and release it but i know there are more ppl. without any ideas for new plugins.
i will just share the Silly code which i wrote and if you like, check the code and see how the gameplay is.
you can add shops/buymenus/healers and .... many more things in it.
i will try for first to finish the plugins and if no one released this mod, release it by my self.
btw. i think the new catchmod takes about 1-2 mounths... in far you can try to code it ( if you like )
PS. dont post anything about the code. i wrote it in 2 minutes just to check it in game.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#define PLUGIN "Deathmatch Life system"
#define VERSION "1.0.1"
#define AUTHOR "Dr.One"
new cvar_gametyp,ctslife,tslife
new users_life[33]
new lifes
new users_firstspawn[33]
new team_life[2]
new team_lifes
new g_MaxClients
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
cvar_gametyp = register_cvar("amx_gametyp","1") // 0 = off - 1 = normal - 2 = teamplay
RegisterHam( Ham_Spawn, "player","Players_Spawn",1)
lifes = register_cvar("amx_lifes","20") // players life
team_lifes = register_cvar("amx_teamlifes","100") // teams life ( can be removed and use the lifes but its better to have 2 cmds.
RegisterHam(Ham_Killed, "player", "player_killed", 1)
g_MaxClients = get_maxplayers()
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
}
public Players_Spawn(id)
{
if(!get_pcvar_num(cvar_gametyp)) // useless
{
return PLUGIN_HANDLED
}
if(get_pcvar_num(cvar_gametyp) == 1) // normal teamplay
{
if(is_user_alive(id) && !users_firstspawn[id])
{
users_firstspawn[id] = 1 // just to set lifes
users_life[id] = get_pcvar_num(lifes)
}
show_lifes(id) // willbe showed as HUD ( LATER )
}
else if(get_pcvar_num(cvar_gametyp) == 2) // TEAMPLAY MOD
{
if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
{
//team_life[0] = ctslife // TO GET LIFES AND MORE INFO TO SHOW EM AS HUD INFO
}
else if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)
{
//team_life[1] = tslife
}
show_team_life(id) // willbe showed as HUD ( LATER )
}
return PLUGIN_HANDLED
}
public player_killed(victim, attacker)
{
if(!(0 < attacker <= g_MaxClients) || !is_user_connected(attacker))
{
return PLUGIN_HANDLED
}
if(!get_pcvar_num(cvar_gametyp)) // USELESS
{
return PLUGIN_HANDLED
}
/* SAME THINGS */
if(get_pcvar_num(cvar_gametyp) == 1)
{
users_life[victim]--
if(users_life[victim] > 0)
{
ExecuteHamB(Ham_CS_RoundRespawn, victim)
// FIX THE DEAD MSG IN SCOREBOARD
// SEND MSG TO TEAM "USER XXX LOOSE X LIFE/S
client_print(victim,print_chat,"RESPAWNED! YOU HAVE %d LIVES",users_life[victim])
}
else
{
client_print(victim,print_chat,"Sorry YOU DONT HAVE NO LIVES ANYMORE")
}
}
if(get_pcvar_num(cvar_gametyp) == 2)
{
if(is_user_connected(victim) && cs_get_user_team(victim) == CS_TEAM_CT)
{
team_life[0]--
if(team_life[0] > 0)
{
ExecuteHamB(Ham_CS_RoundRespawn, victim)
client_print(victim,print_chat,"RESPAWNED! YOUR TEAM HAS %d LIVES",team_life[0])
}
else
{
client_print(victim,print_chat,"YOUR TEAM HAS NO LIVES ANYMORE")
}
}
else if(is_user_connected(victim) && cs_get_user_team(victim) == CS_TEAM_T)
{
team_life[1]--
if(team_life[1] > 0)
{
ExecuteHamB(Ham_CS_RoundRespawn,victim)
client_print(victim,print_chat,"RESPAWNED! YOUR TEAM HAS %d LIVES",team_life[1])
}
else
{
client_print(victim,print_chat,"YOUR TEAM HAS NO LIVES ANYMORE")
}
}
}
return PLUGIN_HANDLED
}
public show_lifes(id)
{
client_print(id,print_chat,"YOU HAVE %d LIVES",users_life[id]) // CHECK IF ITS FIRST RESPAWN. THE MSGS WILLBE SHOWED IN HAM KILLED OR REMORE EM IN HAMKILLED
}
public show_team_life(id)
{
if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(id,print_chat,"YOUR TEAM HAS %d LIVES",team_life[0])
}
else if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)
{
client_print(id,print_chat,"YOUR TEAM HAS %d LIVES",team_life[1])
}
}
public event_new_round() // ROUNDTIME 0 - JUST IN CASE A TEAM HAS A WIN
{
if(get_pcvar_num(cvar_gametyp) == 1)
{
for(new i=1; i <= g_MaxClients;i++)
{
users_life[i] = get_pcvar_num(lifes)
}
}
else if(get_pcvar_num(cvar_gametyp) == 2)
{
team_life[0] = get_pcvar_num(team_lifes)
team_life[1] = get_pcvar_num(team_lifes)
}
}
__________________