PHP Code:
/* Create Modes with Zombie Plague style, but for normal Counter Strike */
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define VERSION "1.0"
new cvar_mode, cvar_min_players, cvar_chance //We register our pcvars
new g_newround
new g_endround
new g_lastmode
new g_modexample //And the Variables
/*Also we have to enum our modes for the game */
enum
{
MODE_NONE = 0,
MODE_KNIVES
}
public plugin_init()
{
register_plugin("KNIVES", VERSION, "arvEL.-") //We register the Plugin Name and the Plugin Author
register_event( "HLTV", "RoundStart", "a", "1=0", "2=0" ) //Here the RoundStart event (When the round starts)
register_logevent("Round_end", 2, "1=Round_End") //Here the round_end event (When the round ends)
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage") //Here when the player takes damage
//Aquí registramos las pcvars
cvar_mode = register_cvar("modes_toggle", "1") //If the modes are enabled
cvar_min_players = register_cvar("mode_min_players", "2")
cvar_chance = register_cvar("mode_chances", "50")
}
public RoundStart()
{
g_newround = true
g_endround = false
g_modexample = false
set_task(2.0, "go_to_mode") //Later of setting the Variables true or false, we set a task to the public "go_to_mode"
}
public Round_end()
{
g_newround = false //We set again this false
g_endround = true //And this true
}
public go_to_mode()
{
start_mode(MODE_NONE)
}
start_mode(mode)
{
static iPlayersnum
iPlayersnum = get_playersnum() //We get the number of players
if (iPlayersnum < 1) //If players number < 1, start with no mode
{
set_task(2.0, "go_to_mode")
return;
}
g_newround = false
if ((mode == MODE_NONE || (g_lastmode != MODE_KNIVES) && random_num(1, get_pcvar_num(cvar_chance)) && get_pcvar_num(cvar_mode) && iPlayersnum >= get_pcvar_num(cvar_min_players)) || mode == MODE_KNIVES)
{
g_modexample = true //Our mode is now true
g_lastmode = MODE_KNIVES
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 5.0) //So we send a message to the players
show_hudmessage(0, "The example mode was started!")
}
}
public fw_TakeDamage(victim)
{
if (g_newround || g_endround)
return HAM_SUPERCEDE;
if (g_modexample)
return HAM_IGNORED; //The mode can't affect the gameplay, so we return it
return PLUGIN_CONTINUE;
}
i find this codes and edit it
but it's have problem everyround the mode running
how can i make it like modes zombie
example:
in zombie 10 rounds normall infection and after than maybe server will
used mode sniper or nemesis or...
what problem in my codes??
__________________