AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Vehicle block use (https://forums.alliedmods.net/showthread.php?t=228773)

OnePL 10-26-2013 20:19

Vehicle block use
 
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;
}


OnePL 10-27-2013 06:08

Re: Vehicle block use
 
@LordOfNothing
It's not going to work.

ConnorMcLeod 10-27-2013 06:26

Re: Vehicle block use
 
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;



OnePL 10-27-2013 07:41

Re: Vehicle block use
 
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)

ConnorMcLeod 10-27-2013 08:46

Re: Vehicle block use
 
Quote:

Originally Posted by OnePL (Post 2053429)
Your code is the same as mine.

Absolutely not, your usage of variable 'something' is wrong.

OnePL 10-27-2013 08:57

Re: Vehicle block use
 
Quote:

Originally Posted by ConnorMcLeod (Post 2053434)
Absolutely not, your usage of variable 'something' is wrong.

Sorry, I just wrote the wrong variable in the post.


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

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