Jump to content

createobject


kevin11

Recommended Posts

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

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

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
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 :wink:

Link to comment
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...