golanu21 Posted March 12, 2013 Share Posted March 12, 2013 addEventHandler("onPlayerCommand", root, function (source, cmd, gunid, ammo) if cmd = = "addevent" then local x, y, z = getLocalPlayer (source) local accName = getAccountName( getPlayerAccount(source) ) if gunid and ammo then if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admins" ) ) then eventmarker = createMarker (x, y, z, "cylinder", 5, 0, 0, 0, 0 ) outputChatBox ("Adminul"..accName.."a pornit un event. [/joinevent]", source, 255, 0, 0 ) else outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]", source, 255, 0, 0 ) else outputChatBox ("Tre sa fi un admin boule", source, 255, 0, 0 ) else if cmd = = "joinevent" then giveWeapon (source, gunid, ammo) outputChatBox("Ai intrat in event", source, 0, 255, 0 ) setElementPosition ( source, eventmarker ) end end end end end ) [14:49:31] SCRIPT ERROR: 3: 'then' expected near '=' [14:49:31] WARNING: 'then' expected near '= Link to comment
csiguusz Posted March 12, 2013 Share Posted March 12, 2013 (edited) if cmd == "addevent" then There is one space more. Edited March 12, 2013 by Guest Link to comment
qaisjp Posted March 12, 2013 Share Posted March 12, 2013 addEventHandler("onPlayerCommand", root, function (source, cmd, gunid, ammo) if cmd == "addevent" then local x, y, z = getLocalPlayer (source) local accName = getAccountName( getPlayerAccount(source) ) if gunid and ammo then if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admins" ) ) then eventmarker = createMarker (x, y, z, "cylinder", 5, 0, 0, 0, 0 ) outputChatBox ("Adminul"..accName.."a pornit un event. [/joinevent]", source, 255, 0, 0 ) else outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]", source, 255, 0, 0 ) else outputChatBox ("Tre sa fi un admin boule", source, 255, 0, 0 ) else if cmd = = "joinevent" then giveWeapon (source, gunid, ammo) outputChatBox("Ai intrat in event", source, 0, 255, 0 ) setElementPosition ( source, eventmarker ) end end end end end ) Link to comment
X-SHADOW Posted March 12, 2013 Share Posted March 12, 2013 (edited) Dleated . Edited March 12, 2013 by Guest Link to comment
golanu21 Posted March 12, 2013 Author Share Posted March 12, 2013 [14:59:23] SCRIPT ERROR:12: 'end' expected (to close 'if' at line 7) near 'else' [14:59:23] WARNING: 12: 'end' expected (to close 'if' at line 7) near 'else' idk where i need to put end Link to comment
qaisjp Posted March 12, 2013 Share Posted March 12, 2013 golanu. read the error. SCRIPT ERROR:12: 'end' expected (to close 'if' at line 7) near 'else' This means that on line 12 there is an error. read it and debug it yourself. Link to comment
X-SHADOW Posted March 12, 2013 Share Posted March 12, 2013 (edited) Deleated. Edited March 12, 2013 by Guest Link to comment
golanu21 Posted March 12, 2013 Author Share Posted March 12, 2013 i type /addevent and his need to give me outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]", source, 255, 0, 0 ) but nothing Link to comment
qaisjp Posted March 12, 2013 Share Posted March 12, 2013 X-SHADOW, don't modify your code. It spoils the nature of the forum. Make a new post. also golanu check the code Link to comment
golanu21 Posted March 12, 2013 Author Share Posted March 12, 2013 don't work , i type, /addevent 30 100 and give me outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo] Link to comment
X-SHADOW Posted March 12, 2013 Share Posted March 12, 2013 Because he put getLocalPlayer and it's only ClientSide should replace with source and there is space in joinevent . Link to comment
golanu21 Posted March 12, 2013 Author Share Posted March 12, 2013 local x, y, z = getElementPosition (source) Link to comment
golanu21 Posted March 12, 2013 Author Share Posted March 12, 2013 this is the script man addEventHandler("onPlayerCommand", root, function ( cmd, gunid, ammo) if cmd == "addevent" then local x, y, z = getElementPosition (source) local accName = getAccountName( getPlayerAccount(source) ) if gunid and ammo then if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admins" ) ) then eventmarker = createMarker (x, y, z, "cylinder", 5, 0, 0, 0, 0 ) outputChatBox ("Adminul"..accName.."a pornit un event. [/joinevent]", source, 255, 0, 0 ) else outputChatBox ("Tre sa fi un admin boule", source, 255, 0, 0 ) end else outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]", source, 255, 0, 0 ) end else if cmd == "joinevent" then giveWeapon ( tonumber(gunid), tonumber(ammo)) outputChatBox("Ai intrat in event", source, 0, 255, 0 ) setElementPosition ( source, eventmarker ) end end end) Link to comment
qaisjp Posted March 12, 2013 Share Posted March 12, 2013 For sake, we aren't here to fix your scripts at your beck and call. Part of scripting is to fix what mistakes you make, now learn how to debug or just.. sorry to say but .. or just get out! Link to comment
Jaysds1 Posted March 12, 2013 Share Posted March 12, 2013 try this: local eventmarker addEventHandler("onPlayerCommand", root,function (source, cmd, gunid, ammo) if cmd == "addevent" then local x, y, z = getElementPosition(source)--getLocalPlayer is clientside and use getElementPosition to get the x,y,z local accName = getAccountName( getPlayerAccount(source) ) if gunid and ammo then if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admins" ) ) then eventmarker = createMarker (x, y, z, "cylinder", 5, 0, 0, 0, 0 ) outputChatBox ("Adminul"..accName.."a pornit un event. [/joinevent]", source, 255, 0, 0 ) else outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]", source, 255, 0, 0 ) end --forgot this else outputChatBox ("Tre sa fi un admin boule", source, 255, 0, 0 ) end --forgot this too else if cmd = = "joinevent" then giveWeapon (source, gunid, ammo) outputChatBox("Ai intrat in event", source, 0, 255, 0 ) setElementPosition ( source, getElementPosition(eventmarker))--more arguments are required!!! end end) 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