#RooTs Posted February 4, 2016 Share Posted February 4, 2016 because you are giving bad argument? I'm trying to do, if the player is the VIP group, then display the icon in DX server.lua -- bad argument local acls = { "VIP" } function CarVehiclePainelVip(source) local accName = getAccountName ( getPlayerAccount ( source ) ) for _, k in ipairs ( acls ) do if isObjectInACLGroup ("user."..accName, aclGetGroup(k)) then setElementData(source,"VehiclePainel",true) else setElementData(source,"VehiclePainel",false) end end end addEventHandler ( "onResourceStart", getRootElement(), CarVehiclePainelVip ) client.lua if getElementData( source, 'VehiclePainel' ) then dxDrawImage(botX+sizeX+650, 250, 49, 39, "img/icoRepair.png") end Link to comment
neves768 Posted February 4, 2016 Share Posted February 4, 2016 -- Server-side local acls = {"VIP"} function CarVehiclePainelVip() local accName = getAccountName(getPlayerAccount(source)) for _, k in ipairs(acls) do if isObjectInACLGroup("user."..accName, aclGetGroup(k)) then setElementData(source,"VehiclePainel",true) end end end addEventHandler("onPlayerVehicleEnter", getRootElement(), CarVehiclePainelVip) -- Client-side if getElementData(getLocalPlayer(), "VehiclePainel") then dxDrawImage(botX+sizeX+650, 250, 49, 39, "img/icoRepair.png") end Link to comment
KariiiM Posted February 4, 2016 Share Posted February 4, 2016 Why you looping and you have only one value on table. Link to comment
tosfera Posted February 5, 2016 Share Posted February 5, 2016 It's a mistake you keep on making #RooTs, you're trying to replace the default source variable with a function variable. Stop doing that since it'll only cause a lot of trouble. Also, KariiiM is totally right. You're looping for a table which will only take more memory that required. Try something like this; addEventHandler ( "onPlayerVehicleEnter", getRootElement(), function () local account = getPlayerAccount ( source ); if ( account ) then if ( isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( "VIP" ) ) ) then setElementData ( source, "VehiclePainel", true ); end end end ); Link to comment
#RooTs Posted February 5, 2016 Author Share Posted February 5, 2016 It's a mistake you keep on making #RooTs, you're trying to replace the default source variable with a function variable. Stop doing that since it'll only cause a lot of trouble. Also, KariiiM is totally right. You're looping for a table which will only take more memory that required. Try something like this; addEventHandler ( "onPlayerVehicleEnter", getRootElement(), function () local account = getPlayerAccount ( source ); if ( account ) then if ( isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( "VIP" ) ) ) then setElementData ( source, "VehiclePainel", true ); end end end ); LOL. thanks, guys Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now