Bean666 Posted April 30, 2015 Posted April 30, 2015 (edited) hi guys . please help i have class as Admin but it wont work. i still cant enter the locked vehicle even i have the class as Admin. any help? and all vehicles shows the msg. function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if getElementData(source, "class") ~= "Admin" then cancelEvent() outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) end end addEventHandler("onVehicleStartEnter", getRootElement(), onEnter) Edited April 30, 2015 by Guest Aftermath
Irish Posted April 30, 2015 Posted April 30, 2015 function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if getElementData(thePlayer, "class") ~= "Admin" then cancelEvent() outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) end end addEventHandler("onVehicleStartEnter", getRootElement(), onEnter)
Bean666 Posted April 30, 2015 Author Posted April 30, 2015 doesnt work , and btw all vehicles when i enter them it shows the msg. they are all locked. Aftermath
Irish Posted April 30, 2015 Posted April 30, 2015 (edited) c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) function onEnter(thePlayer) if getElementModel(source) == 520 and getElementData(thePlayer, "class") ~= "Admin" then cancelEvent() outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) end end addEventHandler("onVehicleStartEnter", getRootElement, onEnter) EDIT: function data (plr) if getElementData(plr, "class") ~="Admin" then setElementData(plr, "class", "Admin") outputChatBox("Your class data is: "..getElementData(plr, "class"), plr) else setElementData(plr, "class", "Nope") outputChatBox("Your class data is: "..getElementData(plr, "class"), plr) end end addCommandHandler("class", data) Use this function to add/remove you and check your data so you can be sure whether your data is "Admin" or whatever. Edited April 30, 2015 by Guest
Bean666 Posted April 30, 2015 Author Posted April 30, 2015 both doesnt work. MHS when i use ur code it doesnt create the vehicle. Aftermath
Irish Posted April 30, 2015 Posted April 30, 2015 (edited) Check the code again. You wouldn't have to use a function for creating a vehicle in this resource. The second code (EDIT one) is a function that removes/adds and shows the data, and I guess you've just copied that code which is why the vehicle wasn't created. Edited April 30, 2015 by Guest
Mr.unpredictable. Posted April 30, 2015 Posted April 30, 2015 There was ')' missing in the code in the line 13. function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) end addEventHandler("onResourceStart", root, cars) function onEnter(thePlayer) if getElementModel(source) == 520 and getElementData(thePlayer, "class") ~= "Admin" then cancelEvent() outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) end end addEventHandler("onVehicleStartEnter", getRootElement(Sr))
Walid Posted April 30, 2015 Posted April 30, 2015 you don't need to check the vehicle model it can be like this if source == c1 then we know all that the source of this event (onVehicleStartEnter) is the vehicle in which a player began to enter. 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
Walid Posted April 30, 2015 Posted April 30, 2015 all doesn't work lmao. check my code here 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
Walid Posted April 30, 2015 Posted April 30, 2015 i need for class not skin you can do the same thing just change skins with getElementData. 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
Bean666 Posted April 30, 2015 Author Posted April 30, 2015 i need for class not skin you can do the same thing just change skins with getElementData. tried ur code using skins , didnt even work it was accessible to all skins. Aftermath
Walid Posted April 30, 2015 Posted April 30, 2015 Try this function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) addEventHandler("onVehicleStartEnter", c1, onEnter) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if not isPlayerAdmin(thePlayer) then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end function isPlayerAdmin(plr) if not isElement(plr) then return end if (getElementData(plr,"class") == "Admin") then return true else return false end end 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
WhoAmI Posted April 30, 2015 Posted April 30, 2015 function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if getElementModel(thePlayer) == 520 and getElementData(thePlayer, "class") ~= "Admin" then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end addEventHandler("onVehicleStartEnter", root, onEnter)
Bean666 Posted April 30, 2015 Author Posted April 30, 2015 when i'm in admin class , it is still locked. Aftermath
Walid Posted April 30, 2015 Posted April 30, 2015 when i'm in admin class , it is still locked. bro try this and tell me what you can see in chatbox. function checkClass(player) if not isElement(player) then return end local class = getElementData(player,"class") if class then outputChatBox("You current calss is : "..class,player,255,0,0) end end addCommandHandler("class",checkClass) 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
Bean666 Posted April 30, 2015 Author Posted April 30, 2015 function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if getElementModel(thePlayer) == 520 and getElementData(thePlayer, "class") ~= "Admin" then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end addEventHandler("onVehicleStartEnter", root, onEnter) anyone can ride it. Aftermath
Bean666 Posted April 30, 2015 Author Posted April 30, 2015 @Walid it shows Squads , but in TAB , my team is squads... and my class is Alpha Team i'm using Castillo's Spawn panel that we bought before. Aftermath
Walid Posted April 30, 2015 Posted April 30, 2015 (edited) @Walid it shows Squads , but in TAB , my team is squads... and my class is Alpha Team Try this type T/admin in chatBox then try to enter the vehicle function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) addEventHandler("onVehicleStartEnter", c1, onEnter) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if not isPlayerAdmin(thePlayer) then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end function isPlayerAdmin(plr) if not isElement(plr) then return end if (getElementData(plr,"class") == "Admin") then return true else return false end end Edited April 30, 2015 by Guest 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
Walid Posted April 30, 2015 Posted April 30, 2015 wait.edit: doesnt work. Try this i already tried it it's working fine without typing t/admin function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) addEventHandler("onVehicleStartEnter", c1, onEnter) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if not isPlayerAdmin(thePlayer) then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end function isPlayerAdmin(plr) if not isElement(plr) then return end if (getElementData(plr,"class") == "Admin") then return true else return false end end function setMyClassTo (player) if not isElement(player) then return end local class = "Admin" setElementData(player,"class",tostring(class)) end addCommandHandler("admin",setMyClassTo) Note: your class must be different to Admin 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
Bean666 Posted April 30, 2015 Author Posted April 30, 2015 ah nevermind , is there anyway just locked them to a gang? it'll be easier that way. Aftermath
Walid Posted April 30, 2015 Posted April 30, 2015 ah nevermind , is there anyway just locked them to a gang?it'll be easier that way. use the same method every time. 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
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