[DMC] Posted July 5, 2010 Share Posted July 5, 2010 debugged and no errors, i dont know why it doesnt work function() x,y,z = getElementPosition( source ) createObject ( 2993, x, y, z, 120, 0, 0 ) outputChatBox("Party started", source, 0, 255, 0, true) end ) Link to comment
trajik Posted July 5, 2010 Share Posted July 5, 2010 is that the whole code? if so you need a handler to call your functions example: onResourceStart, getRootElement(), function() local x,y,z = getElementPosition( source ) createObject ( 2993, x, y, z, 120, 0, 0 ) outputChatBox("Party started", source, 0, 255, 0, true) end or another possibility could be to name the function and call it that way example: function makeStuff() local x,y,z = getElementPosition( source ) createObject ( 2993, x, y, z, 120, 0, 0 ) outputChatBox("Party started", source, 0, 255, 0, true) end onResourceStart, getRootElement(), makeStuff Link to comment
[DMC] Posted July 5, 2010 Author Share Posted July 5, 2010 same story:S no errors or anything i tried fixing myself but im not good at scripting : ( Link to comment
Spider Pork Posted July 5, 2010 Share Posted July 5, 2010 Uhm... you forgot the addEventHandler function, trajik But I guess you want it in a command, right? Then it should look something like this: function command_makeStuff(player) local x, y, z = getElementPosition(player) createObject(2993, x, y, z, 120, 0, 0) outputChatBox("Party started", player, 0, 255, 0, true) end addCommandHandler("command", command_makeStuff) Link to comment
m4rsje Posted July 8, 2010 Share Posted July 8, 2010 Uhm... you forgot the addEventHandler function, trajik But I guess you want it in a command, right? Then it should look something like this: function command_makeStuff(player) local x, y, z = getElementPosition(player) createObject(2993, x, y, z, 120, 0, 0) outputChatBox("Party started", player, 0, 255, 0, true) end addCommandHandler("command", command_makeStuff) you are right, but there is just 1 thing i like to try to fix. every1 should see "Party started" right? so why are you placing player. now it only shows for him. it should be : addCommandHandler("party", function (plr) local x, y, z = getElementPosition(source) local locName = getZoneName( getElementPosition( plr ) ) object1 = createObject(2993, x, y, z, 120, 0, 0) outputChatBox("Party Team: party started at" .. locName, player) end ) it checks where the party is being started and said in a announce Link to comment
50p Posted July 8, 2010 Share Posted July 8, 2010 m4rsje, if you wanted to show this message to all players why did you put player in outputChatBox? So, you fixed nothing but added a location name which will be joined with "at" in the front ("atGanton", "atLos Stantos", etc.) and will still work for the player who typed the command in or will give you a warning message because player doesn't exist in the code. Link to comment
m4rsje Posted July 8, 2010 Share Posted July 8, 2010 hmm how should it be if its not for the only player, but for every one? Link to comment
50p Posted July 8, 2010 Share Posted July 8, 2010 What is the player doing in outputChatBox line? Where did you get the player from? Link to comment
m4rsje Posted July 8, 2010 Share Posted July 8, 2010 ahh, i think i get it now, i got it working on my server just dont know the outputChatBox(no1 wants to test lawl ) addCommandHandler("party", function (plr) local x, y, z = getElementPosition(plr) local locName = getZoneName( getElementPosition( plr ) ) object1 = createObject(2993, x, y, z) object2 = createObject(2993, x+2, y, z) object3 = createObject(2993, x+2, y+2, z) object4 = createObject(2993, x, y+2, z) outputChatBox("Party Team: party started at " .. locName) end ) addCommandHandler("end", function () destroyElement(object1) destroyElement(object2) destroyElement(object3) destroyElement(object4) outputChatBox("Party Team: party has ended!") end ) there you go, a full script that works, it creates them with /party and deletes them with /end enjoy it. Link to comment
dzek (varez) Posted July 8, 2010 Share Posted July 8, 2010 the problem will be when somebody will double/more use "party" Link to comment
m4rsje Posted July 9, 2010 Share Posted July 9, 2010 the problem will be when somebody will double/more use "party" that is true, but i dont got a clue how do to that Link to comment
dzek (varez) Posted July 9, 2010 Share Posted July 9, 2010 just let only one party on server set variable like: partyOn = 1 on starting party and partyOn = 0 on ending, and just check the values (if) Link to comment
Lordy Posted July 9, 2010 Share Posted July 9, 2010 Don't pass. It's the most basic thing with commands/even gui windows local active = false function yourFunction() if not active then -- if it isn't active yet, only then -- your code, which starts stuff active = true -- set it to active, so it couldn't get duplicated end end function yourSecondFunction() if active then -- only run, if it's active -- your code, which ends stuff here active = false -- as things have been shut down, you can now set it to inactive again end end And when you start something, you call yourFunction, when ending it, yourSecondFunction Link to comment
m4rsje Posted July 9, 2010 Share Posted July 9, 2010 Don't pass. It's the most basic thing with commands/even gui windows local active = false function yourFunction() if not active then -- if it isn't active yet, only then -- your code, which starts stuff active = true -- set it to active, so it couldn't get duplicated end end function yourSecondFunction() if active then -- only run, if it's active -- your code, which ends stuff here active = false -- as things have been shut down, you can now set it to inactive again end end And when you start something, you call yourFunction, when ending it, yourSecondFunction hey thats not even hard thx 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