Adde Posted August 28, 2013 Posted August 28, 2013 Hey! Got a prob, I don´t understand what the debug means. Or I understand where the problem is but not how to solve it anyone that can help me? debug ( when entering the specified vehicle ) = server.lua4:attempt to compare string with number the script: vehicleSkins = { [425]=true, [520]=true, [432]=true } function onlyLevel15(thePlayer, seat, jacked) if ( getElementData(thePlayer, "Level") <= 16 ) then if ( vehicleSkins[getElementModel(source)] ) then removePedFromVehicle ( thePlayer ) outputChatBox("You need to be atleast level 15 to be able to use this vehicle",thePlayer, 255,0,0) end end end addEventHandler("onVehicleEnter", getRootElement(), onlyLevel15)
bandi94 Posted August 28, 2013 Posted August 28, 2013 vehicleSkins = { [425]=true, [520]=true, [432]=true } function onlyLevel15(thePlayer, seat, jacked) if tonumber(getElementData(thePlayer, "Level") ) <= 16 then if ( vehicleSkins[getElementModel(source)] ) then removePedFromVehicle ( thePlayer ) outputChatBox("You need to be atleast level 15 to be able to use this vehicle",thePlayer, 255,0,0) end end end addEventHandler("onVehicleEnter", getRootElement(), onlyLevel15)
Adde Posted August 28, 2013 Author Posted August 28, 2013 Thx it works, btw why wont cancelEvent() work instead of removePedFromVehicle? Nothing in debug. I found the reason, i changed onVehicleEnter to onVehicleStartEnter. vehicleSkins = { [425]=true, [520]=true, [432]=true } function onlyLevel15(thePlayer, seat, jacked) if tonumber(getElementData(thePlayer, "Level") ) <= 16 then if ( vehicleSkins[getElementModel(source)] ) then cancelEvent() outputChatBox("You need to be atleast level 15 to be able to use this vehicle",thePlayer, 255,0,0) end end end addEventHandler("onVehicleEnter", getRootElement(), onlyLevel15)
Moderators IIYAMA Posted August 28, 2013 Moderators Posted August 28, 2013 btw is your operator ok? Because when you are level 17 it probably isn't going to working. if tonumber(getElementData(thePlayer, "Level") or 0 ) >= 15 then
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