kevin11 Posted June 5, 2010 Share Posted June 5, 2010 hey i made this and it doesnt give any error:S help? addEvent ("Showdisc", true) function showDisco () local Pnick = getPlayerName( source ) if ( getPlayerMoney (source) >= 0 ) then takePlayerMoney(source, 0) x,y,z = getElementPosition( source ) createObject ( 18102, x, y, z, 0, 0, 0 ) outputChatBox( Pnick.. " started the disco for $500, Have fun", source, 255, 255, 0, true) end addCommandHandler("buy disco",showDisco) end Link to comment
DiSaMe Posted June 5, 2010 Share Posted June 5, 2010 You need to add command handler outside the function. Link to comment
The_Ex Posted June 5, 2010 Share Posted June 5, 2010 function showDisco () local Pnick = getPlayerName( source ) if ( getPlayerMoney (source) >= 0 ) then takePlayerMoney(source, 0) x,y,z = getElementPosition( source ) createObject ( 18102, x, y, z, 0, 0, 0 ) outputChatBox( Pnick.. " started the disco for $500, Have fun", source, 255, 255, 0, true) end end addCommandHandler("buy disco",showDisco) and takePlayerMoney(source, 0) Really? take 0? Link to comment
kevin11 Posted June 5, 2010 Author Share Posted June 5, 2010 hahah its to test doesnt work expected to close funtion near end line 11 Link to comment
50p Posted June 5, 2010 Share Posted June 5, 2010 Functions triggered by commands don't pass any source. Those functions need parameters. Add player argument to the function. AFAIR, commands can't have spaces but additional arguments are passed to the handler function. function showDisco( player, _, arg ) if ( arg == "disco" ) then ... After that, change all source to player. I hope you understood what I wrote and you'll be able to fix it yourself. Link to comment
kevin11 Posted June 5, 2010 Author Share Posted June 5, 2010 Functions triggered by commands don't pass any source. Those functions need parameters. Add player argument to the function. AFAIR, commands can't have spaces but additional arguments are passed to the handler function. function showDisco( player, _, arg ) if ( arg == "disco" ) then ... After that, change all source to player. I hope you understood what I wrote and you'll be able to fix it yourself. i try alot before i post here again Link to comment
kevin11 Posted June 5, 2010 Author Share Posted June 5, 2010 addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), function ( winner ) local veh = getPedOccupiedVehicle(winner) if veh then setVehicleFrozen ( veh, true, not isVehicleFrozen ( veh) ) end end) i changed it a little but no work Link to comment
The_Ex Posted June 5, 2010 Share Posted June 5, 2010 addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), function ( winner ) local veh = getPedOccupiedVehicle(winner) if veh then setVehicleFrozen ( veh, true, not isVehicleFrozen ( veh) ) end end) i changed it a little but no work Isn't this wrong topic for that problem? It should be like this setVehicleFrozen ( veh,not isVehicleFrozen ( veh) ) Have you ever visited wiki.multitheftauto.com? There's information about every single function with examples. Link to comment
kevin11 Posted June 6, 2010 Author Share Posted June 6, 2010 ok i tried making this work but its just nt working it isnt showing the objects 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