Jump to content

Help Indeed needed


Alen141

Recommended Posts

Posted

Hey guys I don't need too much of help, but how to use getElementData to make something similar to this

Vehicle lock :

paramedic = createVehicle ( 416,  2037.95703125, -1424.1435546875, 17.071420669556 ) 
  
function lockMedic ( player, seat, jacked ) 
    if ( source == paramedic ) then 
---- I tried everything to define class ---- 
---- but can't figure out problem + got no errors ----  
        if ( class ~= "Paramedic" ) then 
            cancelEvent ( ) 
            outputChatBox ( "Only Paramedics are allowed to use this vehicle!", player, 255, 0, 0, true ) 
        end 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), lockMedic ) 
  

Gangs(class) :

function update() 
   for k, v in ipairs(getElementsByType('player')) do 
       local money = getPlayerMoney(v) 
       setElementData(v,"Money",money )   
   end 
  
        for g, v in ipairs(getElementsByType('player')) do 
        local gang = getElementData(v,"spawnedAs") or "N/A" 
        setElementData(v,"Class",gang ) 
    end 
end 
setTimer(update, 100, 0) 

Posted

Use triggers to trigger the data then use on the other script if its in the same folder, if it isn't you need to make an export

Posted
Use triggers to trigger the data then use on the other script if its in the same folder, if it isn't you need to make an export

ok tnx

Posted

Why dont you just use the example they gave on the wiki?

policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true } 
policeSkins = { [280]=true,[281]=true,[282]=true,[283]=true,[284]=true,[285]=true,[286]=true } 
  
function enterVehicle ( player, seat, jacked ) --when a player enters a vehicle 
    if ( policeVehicles[getElementModel(source)] ) and ( not policeSkins[getElementModel(player)] ) then --if the vehicle is one of 4 police cars, and the skin is not a police skin 
        cancelEvent() 
        outputChatBox ( "Only policeman can enter police cars!", player ) --and tell the player why 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) --add an event handler for onVehicleStartEnter 

source: https://wiki.multitheftauto.com/wiki/On ... StartEnter

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