Jump to content

help


golanu21

Recommended Posts

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

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
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

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 by Guest
Link to comment
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
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
  
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
  
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...