Raised This Month: $ Target: $400
 0% 

Removing train controls from a player


Post New Thread Reply   
 
Thread Tools Display Modes
E1_531G
Senior Member
Join Date: Dec 2017
Old 03-09-2018 , 07:58   Re: Removing train controls from a player
Reply With Quote #11

You use PRE hook.
In PRE the player does not have the control yet, this means ExecuteHam(Ham_Use, ...) is not good here.
__________________
My English is A0
E1_531G is offline
WAR3DM
Senior Member
Join Date: Mar 2016
Old 03-09-2018 , 15:13   Re: Removing train controls from a player
Reply With Quote #12

Unfortunately, same effect:

Code:
new bool:g_cantUseTrain[ 33 ] = false

public plugin_init() {
	register_concmd("amx_test","test",ADMIN_KICK)
	RegisterHam(Ham_Use, "func_vehicle", "train", 1); 
}

public train(ent, id) { 
    if (g_cantUseTrain[id]) 
    { 
		ExecuteHamB(Ham_Use, ent, 0, 1, 0, 0);  
		
        static buttons, msgTrain; 		
		buttons = pev(id, pev_button); 
		
        if (buttons & IN_USE) 
        { 
            set_pev(id, pev_button, buttons & ~IN_USE); 
            set_pev(id, pev_oldbuttons, pev(id, pev_oldbuttons) | IN_USE); 
        } 
		
		message_begin(MSG_ONE, (msgTrain ? msgTrain : (msgTrain = get_user_msgid("Train"))), _, id); 
		write_byte(0); 
		message_end(); 
			
        return HAM_SUPERCEDE; 
    } 
    return HAM_IGNORED; 
}  

public test() {	
	g_cantUseTrain[1] = true	
	return PLUGIN_HANDLED
}
WAR3DM is offline
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 23:31.


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