BriGhtx3 Posted June 9, 2011 Posted June 9, 2011 Hey, i have two scripts : - If I type /ped 400 10 10 10, a car is created, 3 peds and all are teleported into the car 400. - My Carsystem, where i can toggle the motor and lights. My Script (carsystem) : function motor(player,key,state) if getPedOccupiedVehicleSeat ( player ) == 0 then local auto = getPedOccupiedVehicle ( player ) if getVehicleEngineState ( auto ) == false then setVehicleEngineState ( auto, true ) else setVehicleEngineState ( auto, false ) end end end function Licht(player,key,state) if getPedOccupiedVehicleSeat ( player ) == 0 then local auto = getPedOccupiedVehicle ( player ) if getVehicleOverrideLights(auto) == 1 then setVehicleOverrideLights ( auto, 2 ) else setVehicleOverrideLights ( auto, 1 ) end end end function Keybind(player) if getPedOccupiedVehicleSeat ( player ) == 0 then local auto = getPedOccupiedVehicle ( player ) local motor2 = getElementData(auto,"Motor") if motor2 == true then setVehicleEngineState ( auto, true ) else setVehicleEngineState ( auto, false ) end setVehicleOverrideLights ( auto, 1 ) bindKey ( player, "X", "down", motor ) bindKey ( player, "L", "up", Licht ) end end addEventHandler("onVehicleEnter", getRootElement(), Keybind) function unKeybind(player) if getPedOccupiedVehicleSeat ( player ) == 0 then unbindKey ( player, "X", "down", motor ) unbindKey ( player, "L", "up", Licht ) end end addEventHandler("onVehicleExit", getRootElement(), unKeybind) And the admincommand : function ped ( thePlayer, command, vehicle, skin1, skin2, skin3 ) if isAdmin( thePlayer, AdminCommand[string.lower(command)] ) then if tonumber(skin1) and tonumber(skin2) and tonumber(skin3) and tonumber(vehicle) then local pX, pY, pZ = getElementPosition( thePlayer ) local Ped1 = createPed ( skin1, 0, 0, 3 ) local Ped2 = createPed ( skin2, 0, 0, 3 ) local Ped3 = createPed ( skin3, 0, 0, 3 ) local veh = createVehicle( vehicle, pX, pY, pZ ) warpPedIntoVehicle ( Ped1, veh ) warpPedIntoVehicle ( Ped2, veh ) warpPedIntoVehicle ( Ped3, veh ) warpPedIntoVehicle ( thePlayer, veh ) outputChatBox( "Du hast Menschen in dein Auto teleportiert.", thePlayer ) else outputChatBox( "Benutzung : /ped [AUTO ID] [sKIN1] [sKIN2] [sKIN3]", thePlayer ) end else outputChatBox( "Du hast nicht das Recht dazu!", thePlayer ) end end My Error(s) : When I type /ped 400 10 10 10 (for example), a car is created and im teleported into this car. But not the peds! The errors : Bad "Player" pointer at bindkey (39) Bad "Player" pointer at bindkey (40) The Lines : bindKey ( player, "X", "down", motor ) bindKey ( player, "L", "up", Licht ) Of course I know the error, but i don't know how to fix it (the error is that the script cant bind the keys to the created peds) xthepr0mise
karlis Posted June 9, 2011 Posted June 9, 2011 first, i think you should define the seat the ped need to be warped into, so they don't stack.
BriGhtx3 Posted June 9, 2011 Author Posted June 9, 2011 You mean like : warpPedIntoVehicle ( Ped1, veh, 2 ) <-- seat 1 ?
BriGhtx3 Posted June 9, 2011 Author Posted June 9, 2011 Alright it works, thanks My next Problem : Schranke = createObject ( 968, 1557.6271972656, 2228.3720703125, 9.8182258605957, 0, 0, 0 ) markeraussens = createMarker ( 1562, 2232.5, 10, "cylinder", 5, 0, 0, 0, 0 ) markerinnens = createMarker ( 1554, 2232.5, 10, "cylinder", 5, 0, 0, 0, 0 ) toggle = 0 function toggleSchrankeAussen(thePlayer,command) if toggle == 0 then setElementRotation (Schranke, 0, 0, 277) toggle = 1 else setElementRotation (Schranke, 0, 0, 0) toggle = 0 end end function toggleSchrankeInnen(thePlayer,command) if toggle == 0 then setElementRotation (Schranke, 0, 0, 277) toggle = 1 else setElementRotation (Schranke, 0, 0, 0) toggle = 0 end end addEventHandler( "onMarkerHit", markeraussens, toggleSchrankeAussen ) addEventHandler( "onMarkerHit", markerinnens, toggleSchrankeInnen ) First the Barrier should be closed (rotation 0, but it is open). Then when I hit the marker, it should open and then close (when you leave the marker). How can I do this? EDIT : GOT IT, no questions
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