5 say .ff = server restart.
If they regret say .ff they can say .noff
When someone write .ff server say 1/5 giving up.
When 1 more writes .ff server say 2/5 giving up.
When 1 of those say .noff server say 1/5 giving up.
Code:
#include <amxmodx>
#include <cstrike>
new bool:gReady[33] = false
new bool:gReStart = false
new gReadyNum
public plugin_init()
{
// PLUGIN ORIGINAL CODED BY AssKicR
// most work on this plugin was done by him.
// Coding errors corrected by KristianI
register_plugin("Ready?","6.2","KristianI")
register_clcmd("say .ff","HandleReady")
register_clcmd("say .noff","HandleStop")
register_clcmd("say .status","HandleStatus")
register_cvar("sv_minplayers","5")
}
public HandleReady(id)
{
if(!gReady[id]) {
gReady[id] = true
gReadyNum += 1
HandleStatus
}else{
client_print(id,print_chat,"You are giving up already!")
}
}
public HandleStop(id)
{
if(gReady[id]) {
gReady[id] = false
gReadyNum -= 1
client_print(id,print_chat,"You are not giving up!")
HandleStatus
//client_print(0,print_chat,"%i/%i giving up!",gReadyNum,get_playersnum())
}else{
client_print(id,print_chat,"You are not giving up!")
}
}
public HandleStatus()
{
// Print number of players ready to chat
client_print(0,print_chat,"%i/%i are giving up!",gReadyNum,get_cvar_num("sv_minplayers"))
// Checks the number of players ready compared to number of
// players needed to start the game (sv_minplayers)
if (gReadyNum==get_cvar_num("sv_minplayers") && !gReStart) {
gReStart = true
goLIVE
server_cmd( "restart" ) // execute the command start - this is an alias from
// one of my .cfg files
// feel free to edit the command or make the alias as I did.
}
}
public client_disconnect(id)
{
if (gReady[id]==true) {
gReady[id]=false
gReadyNum -= 1
}
}
public goLIVE() {
for (new playerID=0; playerID<33; playerID++) {
gReady[playerID]=false
}
gReadyNum = 0
gReStart = false
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1030{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/