i try to learning events, i want for now block duck in freezetime.
question 0: for event i need learn all parameters on the event ? or verbal is ok, im ask because all event are const.
question 1: when i duck in freezetime i see my print duck not allowed in freezetime! but, when i try remove the action of the duck entity_set_int(id, EV_INT_button, button & ~IN_DUCK);, not working.
question 2: dont know why but, get_user_name/get_user_info(id,"name"... its set the server name, can i do it post like RegisterHam ?
Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <hamsandwich>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "nacknic"
new g_countrounds,
g_nick[32],
HamHook:g_hamplayerduck;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("HLTV", "freezetime", "a", "1=0", "2=0");
register_logevent("roundstart", 2, "1=Round_Start");
register_logevent("roundend", 2, "1=Round_End");
DisableHamForward(g_hamplayerduck = RegisterHam(Ham_Player_Duck, "player", "duckFunc"));
}
public freezetime(id)
{
EnableHamForward(g_hamplayerduck);
new ftime; ftime = get_cvar_num("mp_freezetime");
get_user_name(id, g_nick, charsmax(g_nick));
client_print(0, print_chat, "%s freezetime on, please wait: %d", g_nick, ftime);
}
public roundstart()
{
DisableHamForward(g_hamplayerduck);
client_print(0, print_chat, "freezetime off, the round start right now, (Round Num: %d)", g_countrounds);
g_countrounds++;
}
public roundend()
{
client_print(0, print_chat, "round end, please wait for the next one");
}
public duckFunc(id)
{
new button = entity_get_int(id, EV_INT_button);
if(button & IN_DUCK)
{
client_print(id, print_chat, "duck not allowed in freezetime!");
entity_set_int(id, EV_INT_button, button & ~IN_DUCK);
}
}
question 3: i understood for all fakemetamethod there engine method to do the same:
Code:
register_forward(FM_ClientUserInfoChanged, "fwClientUserInfoChanged")
so its fakemeta, how i do the same thing in engine ?
*notice: i decided learn events before fakemeta.
next question 4: i saw in some codes, using id in barket on array like this:
Code:
public function(id)
{
new arr[11];
arr[id] // what the meaning for that ?
}
in this get_name works, becuase he hvae paramter to to pre = 0 or 1 = post:
Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "doronxyz"
new g_nick[11];
public plugin_init() RegisterHam(Ham_Spawn, "player", "HamSpawn", 1); //1 = post
public HamSpawn(id)
{
new cid[1]; cid[0] = id;
new ftime; ftime = get_cvar_num("mp_freezetime");
new Float:freezetime = float(ftime)
get_user_name(id, g_nick, charsmax(g_nick));
client_print(0, print_chat, "hake ya zain");
if(equali(g_nick, "elad")) set_task(freezetime, "killSomeone", 0, cid, 1);
else return HAM_HANDLED;
return HAM_HANDLED;
}
public killSomeone(cid[])
{
client_print(0, print_chat, "%s, meyakim lo mshkim cs 1.6", g_nick);
user_kill(cid[0]);
}
question 5: there any tutorial for all events ? its hard search all event separately
this sucks:
https://wiki.alliedmods.net/Half-life_1_game_events