TorNix~|nR Posted July 9, 2016 Posted July 9, 2016 hello everyone, I have admin panel of give vehicle, I want to cancel event for some vehicles, I make this and it won't work, any help please local inValidVehicles = {[429] = true} --giveVehicle addEvent("AdminPanel.giveVehicle", true) function giveVehicle(plr, getText) outputChatBox("#FF0000" ..getPlayerName(source).."#00FF00 Te ha dado un Vehiculo #0B00FF("..getText..") ", plr, r, g, b, true) outputChatBox("#00FF00Has dado a #FF0000" ..getPlayerName(plr).."#00FF00 Un Vehiculo #0B00FF(" ..getText..") ", source, r, g, b, true) if (not isElement(plr)) then return end if (isPedInVehicle(plr)) then outputChatBox("#00FF00Ya en un vehiculo", source, 225, 0, 0) else local veh local x, y, z = getElementPosition(plr) local rx, ry, rz = getElementRotation(plr) if inValidVehicles[tonumber(veh)] then outputChatBox("#00FF00Este vehiculo es solo para #FF0000[ADM]", source, r, g, b, true) return end if (getVehicleModelFromName(getText)) then veh = createVehicle(getVehicleModelFromName(getText), x, y, z + 3) setElementData(veh,"spawner",plr) else veh = createVehicle(getText, x, y, z + 3) setElementData(veh,"spawner",plr) end if (veh) then warpPedIntoVehicle(plr, veh) setElementRotation(veh, 0, 0, rz) end end end addEventHandler("AdminPanel.giveVehicle", root, giveVehicle) ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003
Walid Posted July 9, 2016 Posted July 9, 2016 Try this local inValidVehicles = {[429] = true} addEvent("AdminPanel.giveVehicle", true) function giveVehicle(plr, getText) if plr and isElement(plr) then if (isPedInVehicle(plr)) then outputChatBox("#00FF00Ya en un vehiculo", client, 225, 0, 0) else local id = getVehicleModelFromName(getText) if not id then id = getText end if inValidVehicles[tonumber(id)] then outputChatBox("#00FF00Este vehiculo es solo para #FF0000[ADM]", client, 255,0,0, true) return end local position = Vector3(getElementPosition(plr)) local rotation = Vector3(getElementRotation(plr)) local veh = createVehicle(id, position.x, position.y, position.z + 3) setElementData(veh,"spawner",plr) if (veh) then warpPedIntoVehicle(plr, veh) setElementRotation(veh, rotation.x,rotation.y,rotation.z) end outputChatBox("#FF0000" ..getPlayerName(client).."#00FF00 Te ha dado un Vehiculo #0B00FF("..getVehicleNameFromModel(id)..") ", plr, 0, 255, 0, true) outputChatBox("#00FF00Has dado a #FF0000" ..getPlayerName(plr).."#00FF00 Un Vehiculo #0B00FF(" ..getVehicleNameFromModel(id)..") ", client, 0, 255, 0, true) end end end addEventHandler("AdminPanel.giveVehicle", root, giveVehicle) 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
TorNix~|nR Posted July 9, 2016 Author Posted July 9, 2016 Thanks Walid, worked fine! ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003
Walid Posted July 9, 2016 Posted July 9, 2016 Thanks Walid, worked fine! np. 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