Castillo Posted March 18, 2014 Posted March 18, 2014 Try adding this at the top of the script: addEvent ( "onPlayerPickUpRacePickUp", true Also, what is "onClientRender" doing in a server side script? this event is client side only.
Newbie Posted March 18, 2014 Author Posted March 18, 2014 Try adding this at the top of the script: addEvent ( "onPlayerPickUpRacePickUp", true Also, what is "onClientRender" doing in a server side script? this event is client side only. addEvent ( "onPlayerPickUpRacePickUp", true Didnt helped
cheez3d Posted March 18, 2014 Posted March 18, 2014 You forgot a pharanthesis at the end. addEvent("onPlayerPickUpRacePickup",true)
Newbie Posted March 18, 2014 Author Posted March 18, 2014 You forgot a pharanthesis at the end. addEvent("onPlayerPickUpRacePickup",true) I dont. I did it. Why it doesn't work..
Castillo Posted March 18, 2014 Posted March 18, 2014 addEvent ( "onPlayerPickUpRacePickUp", true ) addEventHandler ( "onPlayerPickUpRacePickUp", getRootElement(), function ( pickupID, pickupType, vehicleModel ) if ( pickupType == "vehiclechange" ) then loadVehicleColor ( source ) outputChatBox ( "loadVehicleColor for ".. tostring ( getPlayerName ( source ) ) ) end end ) Use that and see what it says when you take a pickup. 1
Newbie Posted March 19, 2014 Author Posted March 19, 2014 addEvent ( "onPlayerPickUpRacePickUp", true ) addEventHandler ( "onPlayerPickUpRacePickUp", getRootElement(), function ( pickupID, pickupType, vehicleModel ) if ( pickupType == "vehiclechange" ) then loadVehicleColor ( source ) outputChatBox ( "loadVehicleColor for ".. tostring ( getPlayerName ( source ) ) ) end end ) Use that and see what it says when you take a pickup. Doesn't even output.. Looks like the onPlayerPickUpRacePickUp is not working -.-
WhoAmI Posted March 19, 2014 Posted March 19, 2014 addEvent ( "onPlayerPickUpRacePickup", true ) addEventHandler ( "onPlayerPickUpRacePickup", getRootElement(), function ( pickupID, pickupType, vehicleModel ) if ( pickupType == "vehiclechange" ) then loadVehicleColor ( source ) outputChatBox ( "loadVehicleColor for ".. tostring ( getPlayerName ( source ) ) ) end end Check this out. )
Newbie Posted March 19, 2014 Author Posted March 19, 2014 addEvent ( "onPlayerPickUpRacePickup", true ) addEventHandler ( "onPlayerPickUpRacePickup", getRootElement(), function ( pickupID, pickupType, vehicleModel ) if ( pickupType == "vehiclechange" ) then loadVehicleColor ( source ) outputChatBox ( "loadVehicleColor for ".. tostring ( getPlayerName ( source ) ) ) end end Check this out. ) Your code is same as Solid wrote. I tryed but still not works. PS you didn't added )
JR10 Posted March 19, 2014 Posted March 19, 2014 His code is different. He changed the event name to what it should be. Also remove the true from addEvent; it doesn't need remote trigger. Here's the line that triggers the event in race_server.lua from the race gamemode: triggerEvent('onPlayerPickUpRacePickup', source, pickupID, pickup.type, pickup.vehicle) If you haven't tried WhoAmI's code then try it, but remove the true from addEvent. Like this: addEvent ( "onPlayerPickUpRacePickup" ) addEventHandler ( "onPlayerPickUpRacePickup", getRootElement(), function ( pickupID, pickupType, vehicleModel ) if ( pickupType == "vehiclechange" ) then loadVehicleColor ( source ) outputChatBox ( "loadVehicleColor for ".. tostring ( getPlayerName ( source ) ) ) end end
Newbie Posted March 19, 2014 Author Posted March 19, 2014 Thanks. Works now. P.S i have changed from outputChatBox to outputConsole bec caused a lot of spam in chat box
Castillo Posted March 19, 2014 Posted March 19, 2014 There's no need to leave that output, it was just to see if it was being triggered or not.
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