KM_Rose Posted October 14, 2010 Share Posted October 14, 2010 Hi all. I need help, i have check this resource and i want that the surfboard spawn when i type a command. In the server.lua i found this: addEvent( "onSurf_shopStart", true ) function spawnboard(playersource) local x,y,z = getElementPosition( playersource ) ridecar = createVehicle ( 441, x, y+3, z) surfboard = createObject ( 2410, x, y+3, z, 0, 0, 0 ) setElementData ( ridecar, "purpose", "surfboard" ) attachElements ( surfboard, ridecar, 0, 0, 0, 0, 0, 270) setElementAlpha(ridecar, 0) setElementParent ( surfboard, ridecar) triggerClientEvent ( "surfboardcreated", getRootElement(), surfboard ) end [b][color=#FF0000]--addCommandHandler ( "surf", spawnboard )[/color][/b] DISABLED BECAUSE ITS LAME TO USE COMMAND HANDLERS addEventHandler( "onSurf_shopStart", getRootElement(), spawnboard) so i did this: addEvent( "onSurf_shopStart", true ) function spawnboard(playersource) local x,y,z = getElementPosition( playersource ) ridecar = createVehicle ( 441, x, y+3, z) surfboard = createObject ( 2410, x, y+3, z, 0, 0, 0 ) setElementData ( ridecar, "purpose", "surfboard" ) attachElements ( surfboard, ridecar, 0, 0, 0, 0, 0, 270) setElementAlpha(ridecar, 0) setElementParent ( surfboard, ridecar) triggerClientEvent ( "surfboardcreated", getRootElement(), surfboard ) end [b][color=#FF0000]addCommandHandler ( "surf", spawnboard )[/color][/b] DISABLED BECAUSE ITS LAME TO USE COMMAND HANDLERS addEventHandler( "onSurf_shopStart", getRootElement(), spawnboard) But the surf board doesn't spawn. If i go to the surfshop and i select buy a surfboard, the surfboard doesn't spawn. Somebody know what is the problem?? RESOURCE: https://community.multitheftauto.com/index.php?p= ... ils&id=355 Sorry for my bad english. Link to comment
dzek (varez) Posted October 14, 2010 Share Posted October 14, 2010 read debugging page on wiki. are you getting any errors? Link to comment
12p Posted October 14, 2010 Share Posted October 14, 2010 addEvent( "onSurf_shopStart", true ) function spawnboard(playersource) local x,y,z = getElementPosition( playersource ) ridecar = createVehicle ( 441, x, y+3, z) surfboard = createObject ( 2410, x, y+3, z, 0, 0, 0 ) setElementData ( ridecar, "purpose", "surfboard" ) attachElements ( surfboard, ridecar, 0, 0, 0, 0, 0, 270) setElementAlpha(ridecar, 0) setElementParent ( surfboard, ridecar) triggerClientEvent ( "surfboardcreated", getRootElement(), surfboard ) end addCommandHandler ( "surf", spawnboard ) [color=#FF0000]--[/color]DISABLED BECAUSE ITS LAME TO USE COMMAND HANDLERS addEventHandler( "onSurf_shopStart", getRootElement(), spawnboard) Don't forget to delete the "DISABLED..." or add "--" to it. Link to comment
KM_Rose Posted October 15, 2010 Author Share Posted October 15, 2010 OK THANKS! It works now Link to comment
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