Raised This Month: $ Target: $400
 0% 

Vehicle block use


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 10-26-2013 , 20:19   Vehicle block use
Reply With Quote #1

Hello,

I would like to block the use of the vehicle when the variable = true

I have a code:

Code:
#include <amxmodx>
#include <hamsandwich>

new bool:something[33] = true;

public plugin_init() {
	RegisterHam(Ham_Use, "func_vehicle", "BlockPojazd");
	RegisterHam(Ham_Use, "func_vehiclecontrol", "BlockPojazd");
}

public BlockPojazd(ent, id, activator, iType, Float:fValue) {
	if(!is_user_alive(id) || id == activator) return 1;

	if(something) return 4;

	return 1;
}

Last edited by OnePL; 10-26-2013 at 20:21.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Old 10-27-2013, 04:08
LordOfNothing
This message has been deleted by ConnorMcLeod. Reason: again, you post wrong code
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 10-27-2013 , 06:08   Re: Vehicle block use
Reply With Quote #3

@LordOfNothing
It's not going to work.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-27-2013 , 06:26   Re: Vehicle block use
Reply With Quote #4

What do you want to do ? you don't explain what is that variable so it sounds a bit like a XY Problem


Anyway, correct code is (and, DO USE HAM RETURNS CONTANTS) :

PHP Code:
#include <amxmodx>
#include <hamsandwich>

new bool:something[33] = true;

public 
plugin_init() {
    
RegisterHam(Ham_Use"func_vehicle""BlockPojazd");
    
RegisterHam(Ham_Use"func_vehiclecontrol""BlockPojazd");
}

public 
BlockPojazd(entidactivatoriTypeFloat:fValue)
{
    if( 
id != activator && something[id] && is_user_alive(id) )
    {
        return 
HAM_SUPERCEDE;
    }
    return 
HAM_IGNORED;

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-27-2013 at 06:29.
ConnorMcLeod is offline
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 10-27-2013 , 07:41   Re: Vehicle block use
Reply With Quote #5

Your code is the same as mine.
I want to disable the use of the vehicles when the variable something = true
That is, if the variable something = true is can't use the vehicles (won't move)
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-27-2013 , 08:46   Re: Vehicle block use
Reply With Quote #6

Quote:
Originally Posted by OnePL View Post
Your code is the same as mine.
Absolutely not, your usage of variable 'something' is wrong.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 10-27-2013 , 08:57   Re: Vehicle block use
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
Absolutely not, your usage of variable 'something' is wrong.
Sorry, I just wrote the wrong variable in the post.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Reply



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:15.


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