Sande Posted November 5, 2013 Share Posted November 5, 2013 Hey, i am try to make a script what set to the target player element data true, but idk. If i do like /dea-oikeus1k-on Sisuviina goes just error, it just not found my name. Someone can help? i forget all about getTarget, or theres some weird error. function deaOik(thePlayer, target, command) local target = getPlayerFromName ( target ) if ( target ) then setElementData(getPlayerFromName("target"), "DEAaccespass1", true) outputChatBox("[sERVER] Komento onnistui", thePlayer, 0,255,0) else outputChatBox("VIRHE", thePlayer, 255,0,0) end end addCommandHandler("dea-oikeus1k-on", deaOik ) function deaOik1(thePlayer, target, command) local target = getPlayerFromName ( target ) if ( target ) then setElementData(getPlayerFromName("target"), "DEAaccespass1", false) outputChatBox("[sERVER] Komento onnistui", thePlayer, 0,255,0) else outputChatBox("VIRHE", thePlayer, 255,0,0) end end addCommandHandler("dea-oikeus1k-of", deaOik1 ) Link to comment
Ab-47 Posted November 5, 2013 Share Posted November 5, 2013 local target = getPlayerFromName ("target") Show me your debug errors, if any. Link to comment
Sande Posted November 5, 2013 Author Share Posted November 5, 2013 No debug errors, it just not get the player, and puts error. i mean my own error message "VIRHE". function deaOik(thePlayer, target, command) local target = getPlayerFromName ( "target" ) if ( target ) then setElementData(target, "DEAaccespass1", true) outputChatBox("[sERVER] Komento onnistui", thePlayer, 0,255,0) else outputChatBox("VIRHE", thePlayer, 255,0,0) end end addCommandHandler("dea-oikeus1k-on", deaOik ) function deaOik1(thePlayer, target, command) local target = getPlayerFromName ( "target" ) if ( target ) then setElementData(target, "DEAaccespass1", false) outputChatBox("[sERVER] Komento onnistui", thePlayer, 0,255,0) else outputChatBox("VIRHE", thePlayer, 255,0,0) end end addCommandHandler("dea-oikeus1k-of", deaOik1 ) Link to comment
Ab-47 Posted November 5, 2013 Share Posted November 5, 2013 No debug errors, it just not get the player, and puts error. i mean my own error message "VIRHE". function deaOik(thePlayer, target, command) local target = getPlayerFromName ( "target" ) if ( target ) then setElementData(target, "DEAaccespass1", true) outputChatBox("[sERVER] Komento onnistui", thePlayer, 0,255,0) else outputChatBox("VIRHE", thePlayer, 255,0,0) end end addCommandHandler("dea-oikeus1k-on", deaOik ) function deaOik1(thePlayer, target, command) local target = getPlayerFromName ( "target" ) if ( target ) then setElementData(target, "DEAaccespass1", false) outputChatBox("[sERVER] Komento onnistui", thePlayer, 0,255,0) else outputChatBox("VIRHE", thePlayer, 255,0,0) end end addCommandHandler("dea-oikeus1k-of", deaOik1 ) Sorry, this was correct: local target = getPlayerFromName ( target ) but, target has to be defined in the function name after command, I guess.... function deaOik(thePlayer, command, target) Are you sure there's someone in the server with the name "target"? Try reconnecting with the resource running. Link to comment
Sande Posted November 5, 2013 Author Share Posted November 5, 2013 Idk, but it still going to "VIRHE" mean "ERROR". function deaOik(thePlayer, command) local target = getPlayerFromName ( target ) if ( target ) then setElementData(target, "DEAaccespass1", true) outputChatBox("[sERVER] Komento onnistui", thePlayer, 0,255,0) else outputChatBox("VIRHE", thePlayer, 255,0,0) end end addCommandHandler("dea-oikeus1k-on", deaOik ) function deaOik1(thePlayer, command) local target = getPlayerFromName ( target ) if ( target ) then setElementData(target, "DEAaccespass1", false) outputChatBox("[sERVER] Komento onnistui", thePlayer, 0,255,0) else outputChatBox("VIRHE", thePlayer, 255,0,0) end end addCommandHandler("dea-oikeus1k-of", deaOik1 ) Link to comment
pa3ck Posted November 5, 2013 Share Posted November 5, 2013 This is wrong function deaOik(thePlayer, target, command) Change to: function deaOik(thePlayer, command, target) Server side the first argument is always the player ( the source ) who executes the command, second one is the command, 3rd one is the optional argument ( just like 4th, 5th etc) Link to comment
Ab-47 Posted November 5, 2013 Share Posted November 5, 2013 This is wrong function deaOik(thePlayer, target, command) Change to: function deaOik(thePlayer, command, target) Server side the first argument is always the player ( the source ) who executes the command, second one is the command, 3rd one is the optional argument ( just like 4th, 5th etc) I knew it Question, why does it really matter which place you put the arguments? Never-mind, just re-read your post. Link to comment
Sande Posted November 5, 2013 Author Share Posted November 5, 2013 This is wrong function deaOik(thePlayer, target, command) Change to: function deaOik(thePlayer, command, target) Server side the first argument is always the player ( the source ) who executes the command, second one is the command, 3rd one is the optional argument ( just like 4th, 5th etc) Thank you very much! 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