Jump to content

cancelEvent not working!


Xwad

Recommended Posts

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 ) 
  

Link to comment

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 ) 

Link to comment

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 ) 
  

Link to comment

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