golanu21 Posted March 12, 2013 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 '= [Dev]BloWnRPG - We BloW the World [1%]
csiguusz Posted March 12, 2013 Posted March 12, 2013 (edited) if cmd == "addevent" then There is one space more. Edited March 12, 2013 by Guest Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
MTA Team qaisjp Posted March 12, 2013 MTA Team 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 )
X-SHADOW Posted March 12, 2013 Posted March 12, 2013 (edited) Dleated . Edited March 12, 2013 by Guest My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
golanu21 Posted March 12, 2013 Author 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 [Dev]BloWnRPG - We BloW the World [1%]
golanu21 Posted March 12, 2013 Author Posted March 12, 2013 o thanx [Dev]BloWnRPG - We BloW the World [1%]
MTA Team qaisjp Posted March 12, 2013 MTA Team 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.
X-SHADOW Posted March 12, 2013 Posted March 12, 2013 (edited) Deleated. Edited March 12, 2013 by Guest My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
golanu21 Posted March 12, 2013 Author 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 [Dev]BloWnRPG - We BloW the World [1%]
MTA Team qaisjp Posted March 12, 2013 MTA Team 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
X-SHADOW Posted March 12, 2013 Posted March 12, 2013 Deleated . My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
golanu21 Posted March 12, 2013 Author Posted March 12, 2013 don't work , i type, /addevent 30 100 and give me outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo] [Dev]BloWnRPG - We BloW the World [1%]
X-SHADOW Posted March 12, 2013 Posted March 12, 2013 Because he put getLocalPlayer and it's only ClientSide should replace with source and there is space in joinevent . My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
golanu21 Posted March 12, 2013 Author Posted March 12, 2013 local x, y, z = getElementPosition (source) [Dev]BloWnRPG - We BloW the World [1%]
golanu21 Posted March 12, 2013 Author 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) [Dev]BloWnRPG - We BloW the World [1%]
X-SHADOW Posted March 12, 2013 Posted March 12, 2013 Correct ! My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
golanu21 Posted March 12, 2013 Author Posted March 12, 2013 not work [Dev]BloWnRPG - We BloW the World [1%]
MTA Team qaisjp Posted March 12, 2013 MTA Team 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!
Jaysds1 Posted March 12, 2013 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) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
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