Jump to content

help with a simple script


Brad96

Recommended Posts

Posted

hi ,i want to explainme how i am use the bindKey function in server-side

this is my script ,i want to create a vehicle when i press the key ,thanks

function cas(player,key) 
    x, y, z = getElementPosition(player) 
    cs = createVehicle (411 ,x+5 ,y, z) 
    css = createObject (359, x, y, z) 
    css2 = createObject (359, x, y, z) 
    x, y, z = getElementRotation ( cs ) 
    attachElements ( css, cs, 1, 2, 0.20, 0, 0, 90) 
     attachElements ( css2, cs, -1, 2, 0.20, 0, 0, 90) 
    end 
    addEventHandler("onResourceStart",getRootElement(),function () 
    bindKey(player,"2","down",cas) 
     
  
end) 

Mi Nick En El Juego : Bs|Brad

Mi Skype : fer_va_96

Posted
function FunctionName() 
    for index, player in pairs(getElementsByType("player")) do 
        bindKey(player,"2","down",cas) 
    end 
end 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), FunctionName ) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
thanks ,but with a simple functions ?

i think it's very simple

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

is this?

function cas(player) 
    x, y, z = getElementPosition(player) 
    cs = createVehicle (411 ,x+5 ,y, z) 
    css = createObject (359, x, y, z) 
    css2 = createObject (359, x, y, z) 
    x, y, z = getElementRotation ( cs ) 
    attachElements ( css, cs, 1, 2, 0.20, 0, 0, 90) 
     attachElements ( css2, cs, -1, 2, 0.20, 0, 0, 90) 
end 
  
    function FunctionName() 
    for index, player in pairs(getElementsByType("player")) do 
        bindKey(player,"2","down",cas) 
    end 
end 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), FunctionName ) 

Mi Nick En El Juego : Bs|Brad

Mi Skype : fer_va_96

Posted

thanks so mucho but i dont understand this line

  for index, player in pairs(getElementsByType("player")) do 

you can explainme? pls

Mi Nick En El Juego : Bs|Brad

Mi Skype : fer_va_96

Posted

getElementsByType("player"): retrieves a table of the players in the server

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

and how i did the script whitout that line ,that function is complicated for me

Mi Nick En El Juego : Bs|Brad

Mi Skype : fer_va_96

Posted

Try this:

function FunctionName() 
    bindKey(source, "2", "down", cas) 
end 
addEventHandler("onPlayerJoin", root, FunctionName) 

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

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