Raised This Month: $82 Target: $400
 20% 

[HELP] block duck + another questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nacknic
Member
Join Date: Mar 2019
Old 04-15-2019 , 01:44   [HELP] block duck + another questions
Reply With Quote #1

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

Last edited by nacknic; 04-15-2019 at 07:09.
nacknic is offline
JocAnis
Senior Member
Join Date: Jun 2010
Old 04-15-2019 , 03:09   Re: [HELP] block duck + another questions
Reply With Quote #2

It seems like you are jumping from basic things (in pawn) and wants to do some advanced stuff..well that reminds me of me, and i think its not really proper way to work, but yeah its fun

Code:
register_event("HLTV", "freezetime", "a", "1=0", "2=0");
then in public freezetime() i think its better to go with player loop, im not sure if freezetime( index ) works there

also im not sure if its the best way to get freezetime...but if it works then its okay..doing freezetime( index ) and then getting name by index, but printing message to all (0) is not the best logic i think
__________________
KZ Public Autocup

Private (selling) works:

KZ Melee & 1v1 Cup plugin & MapPool (like for XJ)
PrimeKZ Plugin (MySql) - 86% (pointsystem, sv_aa and /slowmo per client, Record Bot[Leet] ect...)
Checkpoin zones for KZ (& DR)
Deathrun Timer

Last edited by JocAnis; 04-15-2019 at 03:11.
JocAnis is offline
nacknic
Member
Join Date: Mar 2019
Old 04-15-2019 , 03:22   Re: [HELP] block duck + another questions
Reply With Quote #3

Quote:
Originally Posted by JocAnis View Post
It seems like you are jumping from basic things (in pawn) and wants to do some advanced stuff..well that reminds me of me, and i think its not really proper way to work, but yeah its fun

Code:
register_event("HLTV", "freezetime", "a", "1=0", "2=0");
then in public freezetime() i think its better to go with player loop, im not sure if freezetime( index ) works there

also im not sure if its the best way to get freezetime...but if it works then its okay..doing freezetime( index ) and then getting name by index, but printing message to all (0) is not the best logic i think
i think its called to early, beacuse of this nit work, the funny thing: when i use RegisterHam its work, i will put later the code her(im not on my pc)
nacknic is offline
JocAnis
Senior Member
Join Date: Jun 2010
Old 04-15-2019 , 06:11   Re: [HELP] block duck + another questions
Reply With Quote #4

RegisterHam(Ham_Spawn.. nad HLTV events arent the same...first is called on every client's spawn...hltv is for new round starting (and probably without index)
__________________
KZ Public Autocup

Private (selling) works:

KZ Melee & 1v1 Cup plugin & MapPool (like for XJ)
PrimeKZ Plugin (MySql) - 86% (pointsystem, sv_aa and /slowmo per client, Record Bot[Leet] ect...)
Checkpoin zones for KZ (& DR)
Deathrun Timer
JocAnis is offline
nacknic
Member
Join Date: Mar 2019
Old 04-15-2019 , 07:00   Re: [HELP] block duck + another questions
Reply With Quote #5

get the nick work her becuase i used 1 = post...
RegisterHam(Ham_Spawn, "player", "HamSpawn", 1);
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]);
}
nacknic is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Location: ISR
Old 04-15-2019 , 12:08   Re: [HELP] block duck + another questions
Reply With Quote #6

As they pointed to you, it is possible to do a few options such as the Round will do
Code:
set_task(get_cvar_num("mp_freezetime")
Public himself of FREEZE, do LOOP
Code:
 for (new i = 0; i < ....; i++)
{
        player = players[i]
Just Example for block duck and allow

Code:
#include <amxmodx> 
#include <fakemeta> 

new g_pAllowDuck, g_pAllowJump 

public plugin_init() 
{ 
    register_plugin("Block", "1.0", "Example") 

    register_forward(FM_CmdStart, "fw_CmdStart_Pre", 0) 

    g_pAllowDuck = register_cvar("amx_allow_duck", "0") 
    g_pAllowJump = register_cvar("amx_allow_jump", "0") 
} 

public fw_CmdStart_Pre(id, uc_handle, seed) 
{ 
    if(!is_user_alive(id)) 
    { 
        return; 
    } 

    new iButtons = get_uc(uc_handle, UC_Buttons) 

    if(iButtons & IN_DUCK) 
    { 
        if(get_pcvar_num(g_pAllowDuck)) 
        { 
            return; 
        } 

        set_uc(uc_handle, UC_Buttons, iButtons & ~IN_DUCK) 
        return; 
    } 

    if(iButtons & IN_JUMP) 
    { 
        if(get_pcvar_num(g_pAllowJump)) 
        { 
            return; 
        } 

        set_uc(uc_handle, UC_Buttons, iButtons & ~IN_JUMP) 
    } 
}
__________________
Youtube Channel:
https://youtube.com/moongr9
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Old 04-17-2019, 08:05
nacknic
This message has been deleted by nacknic. Reason: miss
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:15.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode