KM_Rose Posted October 14, 2010 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.
dzek (varez) Posted October 14, 2010 Posted October 14, 2010 read debugging page on wiki. are you getting any errors? Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
12p Posted October 14, 2010 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.
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