Can some one add in this plugin, even if it is not free if i press a button and i will pres it again it says
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>
//CREDITS TO UNKNOWN AUTHOR.
#define PLUGIN "Deathrun_FreeRun"
#define VERSION "1.0"
#define AUTHOR "UNKNOWN AUTHOR"
enum Color
{
NORMAL = 1, // clients scr_concolor cvar color
GREEN, // Green Color
TEAM_COLOR, // Red, grey, blue
GREY, // grey
RED, // Red
BLUE, // Blue
}
new bool:g_free
new g_free_count
new g_cvar_Tonly
new passed
new TeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_cvar_Tonly = register_cvar("dh_free_run_Tonly", "1")
register_clcmd("say /free", "cmdFree")
register_event("HLTV", "eventRoundStart", "a", "1=0", "2=0")
RegisterHam(Ham_Touch, "armoury_entity", "fwdTouch")
RegisterHam(Ham_Touch, "weaponbox", "fwdTouch")
RegisterHam(Ham_Use, "func_button", "fwdUse")
}
public passing()
{
passed = 1
}
public eventRoundStart()
{
g_free = false
passed = 0
set_task(10.0, "passing")
}
public cmdFree(id)
{
if(passed)
{
if( get_user_team(id) == 1)
{
ColorChat(id, RED, "[ Deathrun ] ^4 10 sec. are passed, you cant do a freerun anymore")
return PLUGIN_HANDLED
}
}
if (get_pcvar_num(g_cvar_Tonly) && get_user_team(id) != 1)
client_print(id, print_center, "Only T can use it!")
else if (g_free)
client_print(id, print_center, "Already FreeRun!")
else if (!is_user_alive(id))
client_print(id, print_center, "You are dead u can't use freerun!")
else
{
set_task(0.3, "setfree")
}
return PLUGIN_HANDLED
}
public setfree()
{
g_free = true
g_free_count++
ColorChat(0, RED, "[ Deathrun ]^x01 Now it's free :)")
new players[32], plNum, i
get_players(players, plNum, "ah")
for (i = 0; i < plNum; i++)
{
fm_strip_user_weapons(players[i])
fm_give_item(players[i], "weapon_knife")
}
set_task(0.3, "freerunmsg")
}
public freerunmsg()
{
if(g_free)
{
set_hudmessage(0, 255, 255, 0.02, -1.0)
show_hudmessage(0, "FreeRun!")
}
}
ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
if( !get_playersnum() ) return;
new message[256];
switch(type)
{
case NORMAL: // clients scr_concolor cvar color
{
message[0] = 0x01;
}
case GREEN: // Green
{
message[0] = 0x04;
}
case GREY: // Grey
{
message[0] = 0x05;
}
default: // White, Red, Blue
{
message[0] = 0x03;
}
}
vformat(message[1], 251, msg, 4);
// Make sure message is not longer than 192 character. Will crash the server.
message[192] = '^0';
new team, ColorChange, index, MSG_Type;
if(id)
{
MSG_Type = MSG_ONE;
index = id;
} else {
index = FindPlayer();
MSG_Type = MSG_ALL;
}
team = get_user_team(index);
ColorChange = ColorSelection(index, MSG_Type, type);
ShowColorMessage(index, MSG_Type, message);
if(ColorChange)
{
Team_Info(index, MSG_Type, TeamName[team]);
}
}
ShowColorMessage(id, type, message[])
{
static bool:saytext_used;
static get_user_msgid_saytext;
if(!saytext_used)
{
get_user_msgid_saytext = get_user_msgid("SayText");
saytext_used = true;
}
message_begin(type, get_user_msgid_saytext, _, id);
write_byte(id)
write_string(message);
message_end();
}
Team_Info(id, type, team[])
{
static bool:teaminfo_used;
static get_user_msgid_teaminfo;
if(!teaminfo_used)
{
get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
teaminfo_used = true;
}
message_begin(type, get_user_msgid_teaminfo, _, id);
write_byte(id);
write_string(team);
message_end();
return 1;
}
ColorSelection(index, type, Color:Type)
{
switch(Type)
{
case RED:
{
return Team_Info(index, type, TeamName[1]);
}
case BLUE:
{
return Team_Info(index, type, TeamName[2]);
}
case GREY:
{
return Team_Info(index, type, TeamName[0]);
}
}
return 0;
}
FindPlayer()
{
new i = -1;
while(i <= get_maxplayers())
{
if(is_user_connected(++i))
return i;
}
return -1;
}
public fwdTouch(ent, id)
{
if (is_user_alive(id) && g_free)
return HAM_SUPERCEDE
return HAM_IGNORED
}
public fwdUse(ent, idcaller, idactivator, use_type, Float:value)
{
if (is_user_alive(idactivator) && g_free && get_user_team(idactivator) == 1)
{
client_print(idactivator, print_center, "It's free you can't use buttons!")
return HAM_SUPERCEDE
}
return HAM_IGNORED
}