golanu21 Posted March 18, 2013 Share Posted March 18, 2013 bindKey(Key,"down", function () guiSetVisible(fereastra,not guiGetVisible(fereastra)) showCursor(guiGetVisible(fereastra)) if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(label,math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end ) key = F2 fereastra = gui window label = guiCreateLabel(12, 25, 309, 66, "Weapon ID", false, fereastra) but when i press F2 do nothing Link to comment
golanu21 Posted March 18, 2013 Author Share Posted March 18, 2013 i fix that with the key i don't put the "", but now i have another problem [18:16:45] WARNING: Gamemode\vehicles\server.lua:36: Bad argument @ 'getElementData' [Expected element at argument 1, got nil] [18:16:45] WARNING: Gamemode\vehicles\server.lua:37: Bad argument @ 'giveWeapon' [Expected element at argument 1, got nil] [18:16:45] WARNING: Gamemode\vehicles\server.lua:38: Bad argument @ 'getElementData' [Expected element at argument 1, got nil] [18:16:45] WARNING: Gamemode\vehicles\server.lua:39: Bad argument @ 'setElementPosition' [Expected element at argument 1, got nil] addEvent("folosestemasina",true) function startevent (Wep, localplayer) players = getElementsByType ( "player" ) for k,v in ipairs(players) do local accountname = "" if (isGuestAccount(getPlayerAccount(v)) == false) then accountname = getAccountName (getPlayerAccount(v)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then marker = createMarker (localplayer, "checkpoint", 2, 255, 255, 255, 0 ) setElementData ( marker, "startevent" ) setElementData ( Wep, "starteventt" ) end end end end addEventHandler("folosestemasina",root, startevent ) function giveweapon ( cmd ) playerss = getElementsByType ( "player" ) for r,s in ipairs(playerss) do local accountnamee = "" if (isGuestAccount(getPlayerAccount(s)) == false) then accountname = getAccountName (getPlayerAccount(s)) if isObjectInACLGroup ( "user." .. accountnamee, aclGetGroup ( "Everyone" ) ) then getElementData ( Wep, "starteventt" ) giveWeapon ( source, Wep, 99999 ) getElementData ( marker, "startevent" ) setElementPosition ( source, marker ) end end end end addCommandHandler ("joinevent", giveweapon ) Link to comment
golanu21 Posted March 18, 2013 Author Share Posted March 18, 2013 I'm not good at getElementData and setElementData Link to comment
iPrestege Posted March 18, 2013 Share Posted March 18, 2013 i fix that with the key i don't put the "", but now i have another problem [18:16:45] WARNING: Gamemode\vehicles\server.lua:36: Bad argument @ 'getElementData' [Expected element at argument 1, got nil] [18:16:45] WARNING: Gamemode\vehicles\server.lua:37: Bad argument @ 'giveWeapon' [Expected element at argument 1, got nil] [18:16:45] WARNING: Gamemode\vehicles\server.lua:38: Bad argument @ 'getElementData' [Expected element at argument 1, got nil] [18:16:45] WARNING: Gamemode\vehicles\server.lua:39: Bad argument @ 'setElementPosition' [Expected element at argument 1, got nil] addEvent("folosestemasina",true) function startevent (Wep, localplayer) players = getElementsByType ( "player" ) for k,v in ipairs(players) do local accountname = "" if (isGuestAccount(getPlayerAccount(v)) == false) then accountname = getAccountName (getPlayerAccount(v)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then marker = createMarker (localplayer, "checkpoint", 2, 255, 255, 255, 0 ) setElementData ( marker, "startevent" ) setElementData ( Wep, "starteventt" ) end end end end addEventHandler("folosestemasina",root, startevent ) function giveweapon ( cmd ) playerss = getElementsByType ( "player" ) for r,s in ipairs(playerss) do local accountnamee = "" if (isGuestAccount(getPlayerAccount(s)) == false) then accountname = getAccountName (getPlayerAccount(s)) if isObjectInACLGroup ( "user." .. accountnamee, aclGetGroup ( "Everyone" ) ) then getElementData ( Wep, "starteventt" ) giveWeapon ( source, Wep, 99999 ) getElementData ( marker, "startevent" ) setElementPosition ( source, marker ) end end end end addCommandHandler ("joinevent", giveweapon ) @ Line "11" SetElementData : Required Arguments theElement: The element you wish to attach the data to. key: The key you wish to store the data under. (Maximum 31 characters.) value: The value you wish to store. See element data for a list of acceptable datatypes. ??? Link to comment
golanu21 Posted March 18, 2013 Author Share Posted March 18, 2013 i put theElement, key, but the value >???? , what it is ? when i use it ? Link to comment
Castillo Posted March 18, 2013 Share Posted March 18, 2013 The value is what you want it to be, you can set it to true. Link to comment
Igorek536 Posted March 18, 2013 Share Posted March 18, 2013 (edited) Can you help me? I have a big problem: not stored weapons on the server. Tried everything and nothing worked. Please help!!! __________________________________________________________________________________________________________ I say at once, I do not know much because the whole LUA Wiki in English typing and I've been through a translator. Edited March 18, 2013 by Guest Link to comment
iPrestege Posted March 18, 2013 Share Posted March 18, 2013 Can you help me? I have a big problem: not stored weapons on the server. Tried everything and nothing worked. Please help!!! You mean you want to save weapons in player account? Link to comment
Igorek536 Posted March 18, 2013 Share Posted March 18, 2013 (edited) Can you help?? Please help me urgently need!! Edited March 18, 2013 by Guest Link to comment
iPrestege Posted March 18, 2013 Share Posted March 18, 2013 Can you help?? https://community.multitheftauto.com/index.php?p=resources&s=details&id=732 Link to comment
Igorek536 Posted March 18, 2013 Share Posted March 18, 2013 I already have the script, I think the problem in a different but that's what? Link to comment
iPrestege Posted March 18, 2013 Share Posted March 18, 2013 I already have the script, I think the problem in a different but that's what? Should work! Link to comment
golanu21 Posted March 18, 2013 Author Share Posted March 18, 2013 addEvent("folosestemasina",true) function startevent (Wep, x, y, z, localPlayer, cmd) local x, y, z = getElementPosition ( source ) marker = createMarker (x, y, z, "checkpoint", 2, 255, 255, 255, 255 ) if cmd == "joinevent" then giveWeapon ( source, weapon, 99999 ) setElementPosition ( source, marker ) weapon = getWeaponIDFromName (Wep) end end addEventHandler("folosestemasina",root, startevent ) no errors, nothing, when i type /joinevent Link to comment
Igorek536 Posted March 18, 2013 Share Posted March 18, 2013 Is there still a good system of conservation?? By the way all the same script that works, but only saves the shotgun! Link to comment
iPrestege Posted March 18, 2013 Share Posted March 18, 2013 addEvent("folosestemasina",true) function startevent (Wep, x, y, z, localPlayer, cmd) local x, y, z = getElementPosition ( source ) marker = createMarker (x, y, z, "checkpoint", 2, 255, 255, 255, 255 ) if cmd == "joinevent" then giveWeapon ( source, weapon, 99999 ) setElementPosition ( source, marker ) weapon = getWeaponIDFromName (Wep) end end addEventHandler("folosestemasina",root, startevent ) no errors, nothing, when i type /joinevent onPlayerCommand Link to comment
Igorek536 Posted March 18, 2013 Share Posted March 18, 2013 did not understand. Can you explain where that write. I do not understand!! Link to comment
Igorek536 Posted March 20, 2013 Share Posted March 20, 2013 Please help!!! Because of this I can not normally play! Please help!!!! Link to comment
X-SHADOW Posted March 20, 2013 Share Posted March 20, 2013 marker = createMarker (x, y, z, "checkpoint", 2, 255, 255, 255, 255 ) --- theMarker addEventHandler('onPlayerCommand', root, --- the Event function (cmd )--- cmd defined local x, y, z = getElementPosition( source ) --- get postion of source if ( cmd == 'joinevent' ) then --- if he type joinevent then giveWeapon( source, 31, 999 )-- give him M4 with 999 ammo end end ) Link to comment
Igorek536 Posted March 20, 2013 Share Posted March 20, 2013 And what? How do I use it? I did not know in LUA!!!!!!! Link to comment
Anderl Posted March 20, 2013 Share Posted March 20, 2013 marker = createMarker (x, y, z, "checkpoint", 2, 255, 255, 255, 255 ) --- theMarker addEventHandler('onPlayerCommand', root, --- the Event function (cmd )--- cmd defined local x, y, z = getElementPosition( source ) --- get postion of source if ( cmd == 'joinevent' ) then --- if he type joinevent then giveWeapon( source, 31, 999 )-- give him M4 with 999 ammo end end ) Why did you use onPlayerCommand's event and didn't use addCommandHandler instead? That's what it is for. And by the way, use local variables. And what? How do I use it? I did not know in LUA!!!!!!! Time to learn. Link to comment
Igorek536 Posted March 21, 2013 Share Posted March 21, 2013 Related probably easy to say! I'm a translator to communicate with you and it takes WIKI awful and nothing is clear. You could not write a specific code for the script and I'll put you in the server. Edit: Now I ask the question a little off topic: How to make so that when spawning player early in the game he was given the skin near spawning scooter and he was given weapons? 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