Jump to content

cancelEvent not working!


Xwad

Recommended Posts

Posted

why is my code not working??

  
tank = {[496]=true} 
skins = { [100]=true,[101]=true,[102]=true,[103]=true } 
  
function disableEnemyTankUsage ( player, seat, jacked ) 
    if ( tank[getElementModel(source)] ) and ( not skins[getElementModel(player)] ) then  
        cancelEvent() 
        outputChatBox ( "Enemy vehicle!", player ) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), disableEnemyTankUsage ) 
  

Posted

Working fine:

Make sure you are not wearing one of these skins : 100,101,102,103.

Make sure you are trying to enter Blista Compact vehicle Id : 496.

local tank = {[496]=true} 
local skins = { [100]=true,[101]=true,[102]=true,[103]=true } 
  
function disableEnemyTankUsage ( player, seat, jacked ) 
    if ( tank[getElementModel(source)] ) and ( not skins[getElementModel(player)] ) then 
        cancelEvent() 
        outputChatBox ( "Enemy vehicle!", player ) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), disableEnemyTankUsage ) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

Hey i have one more question: I want to disable that players can demage other player who are in a vehicle. I made the script but its not working:

  
function stopMinigunDamage ( attacker, weapon, bodypart ) 
outputChatBox("test", 255, 255, 255) 
if isPedInVehicle (localPlayer) then 
cancelEvent() 
end 
end 
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage ) 
  

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...