golanu21 Posted March 18, 2013 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
golanu21 Posted March 18, 2013 Author 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 )
golanu21 Posted March 18, 2013 Author Posted March 18, 2013 I'm not good at getElementData and setElementData
iPrestege Posted March 18, 2013 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. ???
golanu21 Posted March 18, 2013 Author Posted March 18, 2013 i put theElement, key, but the value >???? , what it is ? when i use it ?
Castillo Posted March 18, 2013 Posted March 18, 2013 The value is what you want it to be, you can set it to true.
Igorek536 Posted March 18, 2013 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
iPrestege Posted March 18, 2013 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?
Igorek536 Posted March 18, 2013 Posted March 18, 2013 (edited) Can you help?? Please help me urgently need!! Edited March 18, 2013 by Guest
iPrestege Posted March 18, 2013 Posted March 18, 2013 Can you help?? https://community.multitheftauto.com/index.php?p=resources&s=details&id=732
Igorek536 Posted March 18, 2013 Posted March 18, 2013 I already have the script, I think the problem in a different but that's what?
iPrestege Posted March 18, 2013 Posted March 18, 2013 I already have the script, I think the problem in a different but that's what? Should work!
golanu21 Posted March 18, 2013 Author 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
Igorek536 Posted March 18, 2013 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!
iPrestege Posted March 18, 2013 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
Igorek536 Posted March 18, 2013 Posted March 18, 2013 did not understand. Can you explain where that write. I do not understand!!
Igorek536 Posted March 20, 2013 Posted March 20, 2013 Please help!!! Because of this I can not normally play! Please help!!!!
X-SHADOW Posted March 20, 2013 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 )
Igorek536 Posted March 20, 2013 Posted March 20, 2013 And what? How do I use it? I did not know in LUA!!!!!!!
Anderl Posted March 20, 2013 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.
Igorek536 Posted March 21, 2013 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?
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