
DarkLink
Members-
Posts
610 -
Joined
-
Last visited
Everything posted by DarkLink
-
If u want to put Z for the element u have to put all the arguments before, u cant define an argument after the ones that werent declared. did u understand ? setElementPosition ( element theElement, float x, float y, float z [, bool warp = true ] ) The function gets an element, a float x, a float y , a float z.. and an optional argument. So if u want to declare only the float z, u also need to declare the float x and y and ofc the element. But if u dont want to change the X and Y, put the same . Sorry if u didnt understand, I am portuguese and my english sucks EDIT: Nevermind I didnt understand u, u want this: local x,y,z = getElementPosition (other) setElementPosition(veh, x, y, z +2) try it
-
and 1 its like one meter real ? I mean the length of a car would be like 3/4 meters ? Thanks for ur reply
-
Hi guys, I would like to know how the distant on gta works. I mean, if I use getDistanceBetweenPoints2D , it only counts x and y . But the distance that gives is in meters ? And btw 100 meters on gta is like what? red bridge of san fierro? I would like to know, so I can have an idea.. Thanks!
-
No problem bro
-
didnt had time yet to test ur code wojak, but I will. thanks. that would be awesome eAi !! I would be very good function. So I could use my gamemode better If you guys could do it, I would be grateful Thanks.
-
will briggs I was not doubting about what SDK said! I was asking a different question.. sorry anyway for making many questions . thanks.
-
Okay bro! thanks alot, working now!! Just one more little question, doing this: <team name = "policeSP"> <spawnpoint id="spawnpoint (3)" skin="0" posX="916.21356201172" posY="1951.1668701172" posZ="10.724204063416" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (4)" skin="0" posX="929.68695068359" posY="2066.69921875" posZ="21.701473236084" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (5)" skin="0" posX="942.68170166016" posY="1853.6920166016" posZ="10.671875" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (6)" skin="0" posX="976.0068359375" posY="1877.2258300781" posZ="15.496273994446" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (7)" skin="0" posX="975.92828369141" posY="1974.7801513672" posZ="15.487140655518" rotX="0" rotY="0" rotZ="0" /> </team> we already created a team right? we dont need to create again using createTeam on lua? right? The team is already created if someone uses one spawn right? and then i can use functions of team, dont need to create it , because its already created on .map thanks bro EDIT: Found the answer to my question, teams on .map file are already created, dont need to use createTeam next on .lua. I can already use functions of team, like countPlayersInTeam and such Thanks guys for all the time u lost (u didnt lost, u helped a mate :b)
-
-
bro do this if (isElement(pickupClue) then destroyElement(pickupClue) else outputChatBox("The Element can't be destroyed") end
-
Now I have bad argument at getElementsByType .. on line 7 and 8 of ur code.. why? :c I dont understand what is wrong . Does the map file is fine? <map> <marker id="marker1" type="cylinder" color="#0000ff99" size="2" interior="0" dimension="0" posX="770.58630371094" posY="1668.0819091797" posZ="4.1890187263489" rotX="0" rotY="0" rotZ="0" /> <marker id="marker2" type="cylinder" color="#0000ff99" size="1" interior="0" dimension="0" posX="796.76818847656" posY="1668.2836914063" posZ="6.8681697845459" rotX="0" rotY="0" rotZ="0" /> <team name="policeSP"> <spawnpoint id="spawnpoint (3)" skin="0" posX="916.21356201172" posY="1951.1668701172" posZ="10.724204063416" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (4)" skin="0" posX="929.68695068359" posY="2066.69921875" posZ="21.701473236084" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (5)" skin="0" posX="942.68170166016" posY="1853.6920166016" posZ="10.671875" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (6)" skin="0" posX="976.0068359375" posY="1877.2258300781" posZ="15.496273994446" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (7)" skin="0" posX="975.92828369141" posY="1974.7801513672" posZ="15.487140655518" rotX="0" rotY="0" rotZ="0" /> </team> <team name="immigrantsSP"> <spawnpoint id="spawnpoint (8)" skin="0" posX="916.21356201172" posY="1951.1668701172" posZ="10.724204063416" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (9)" skin="0" posX="929.68695068359" posY="2066.69921875" posZ="21.701473236084" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (10)" skin="0" posX="942.68170166016" posY="1853.6920166016" posZ="10.671875" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (11)" skin="0" posX="976.0068359375" posY="1877.2258300781" posZ="15.496273994446" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (12)" skin="0" posX="975.92828369141" posY="1974.7801513672" posZ="15.487140655518" rotX="0" rotY="0" rotZ="0" /> </team> </map> i think yes.. but anyways, look at it thanks bro
-
guys I tested it and still getting me errors on console.. console error: bad argument at getElementChild this is .map file: <map edf:definitions="ctf,editor_main"> <team name="policeSP"> <spawnpoint id="spawnpoint (3)" skin="0" posX="916.21356201172" posY="1951.1668701172" posZ="10.724204063416" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (4)" skin="0" posX="929.68695068359" posY="2066.69921875" posZ="21.701473236084" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (5)" skin="0" posX="942.68170166016" posY="1853.6920166016" posZ="10.671875" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (6)" skin="0" posX="976.0068359375" posY="1877.2258300781" posZ="15.496273994446" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (7)" skin="0" posX="975.92828369141" posY="1974.7801513672" posZ="15.487140655518" rotX="0" rotY="0" rotZ="0" /> </team> <team name="immigrantsSP"> <spawnpoint id="spawnpoint (8)" skin="0" posX="916.21356201172" posY="1951.1668701172" posZ="10.724204063416" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (9)" skin="0" posX="929.68695068359" posY="2066.69921875" posZ="21.701473236084" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (10)" skin="0" posX="942.68170166016" posY="1853.6920166016" posZ="10.671875" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (11)" skin="0" posX="976.0068359375" posY="1877.2258300781" posZ="15.496273994446" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (12)" skin="0" posX="975.92828369141" posY="1974.7801513672" posZ="15.487140655518" rotX="0" rotY="0" rotZ="0" /> </team> </map> and now this is my code on .lua file: function joinHandler(equipa) local listaSpawnpointPolice = getElementByID("policeSP") local listaSpawnpointImmigrants = getElementByID("immigrantsSP") local nr = tonumber(math.random ( 0, 4 )) local spawnPointPolice = getElementChild(listaSpawnpointPolice, nr) --line13 local spawnPointImmigrants = getElementChild(listaSpawnpointImmigrants, nr) --line14 local playersOnImmigrants = countPlayersInTeam ( immigrantsTeam ) local playersOnPolice = countPlayersInTeam ( policeTeam ) ... ... .. the first problems appear right on the 13 and 14 line... so can u guys tell me what is wrong?? Thanks again.
-
No problem bro, thanks anyway
-
Hm sorry And which error gives on console?
-
I dont know for sure.. but when u put and if, and u next use an elseif u have to put an end before the else if.. like this: [lua] if (clue == 0) then pickupClue = createPickup (-1455.66,-102.42,6.00, 3, 1279) treasure = "I am underground in section E and near EXIT door!" outputChatBox("CLUE: " .. treasure, getRootElement(), 255, 255, 0) end elseif(clue == 1) then ... ... try it bro
-
And how do I get all those spawnpoints defined in that team? In this case, how to get that 2 spawnpoints of team grove on .lua file ? getElementsByType("Grove") ? Thanks! EDIT: I use getElementChild("grove", indexofspawnpoint) right? thanks!
-
Okay thanks bro , will take a look EDIT: I had readed the assault resource, and they talk about spawngroup using spawn area? How do I get a spawngroup to .lua file? also using getElementsByType("nameofspawngroup?") TY
-
Yes but I will make the tables on lua file, I just want to know how to get them from .map . People told me to use getElementsByType , but the type are the same, just spawnpoint . can I set two differents type for the spawnpoints ? Thanks.
-
but this is a gamemode, I dont want players to always change the .lua file I want them to go on map editor. make spawnpoints for team1 and spawnpoints for team2, and then on .lua file i get spawnpoints of team1 to a table and spawnpoints of team2 to another table u see? But I dont know how to manage spawnpoints on .map file, can I put a data element ? like type="team1" ? thanks
-
for players, but I want to make two different zones . 1 zone - the first 5 spawn for police only, when they join police team 2 zone - the last 5 spawn for drugs dealers only, when they join drug dealer team did u understand? thanks
-
Guys I have these on .map files, the spawnpoints. <map edf:definitions="ctf,editor_main"> <spawnpoint id="spawnpoint (3)" skin="0" posX="916.21356201172" posY="1951.1668701172" posZ="10.724204063416" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (4)" skin="0" posX="929.68695068359" posY="2066.69921875" posZ="21.701473236084" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (5)" skin="0" posX="942.68170166016" posY="1853.6920166016" posZ="10.671875" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (6)" skin="0" posX="976.0068359375" posY="1877.2258300781" posZ="15.496273994446" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (7)" skin="0" posX="975.92828369141" posY="1974.7801513672" posZ="15.487140655518" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (8)" skin="0" posX="916.21356201172" posY="1951.1668701172" posZ="10.724204063416" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (9)" skin="0" posX="929.68695068359" posY="2066.69921875" posZ="21.701473236084" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (10)" skin="0" posX="942.68170166016" posY="1853.6920166016" posZ="10.671875" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (11)" skin="0" posX="976.0068359375" posY="1877.2258300781" posZ="15.496273994446" rotX="0" rotY="0" rotZ="0" /> <spawnpoint id="spawnpoint (12)" skin="0" posX="975.92828369141" posY="1974.7801513672" posZ="15.487140655518" rotX="0" rotY="0" rotZ="0" /> </map> And now I want to separate them, like first fives for polices and last five for drug dealers . I tryed to change from spawnpoint to spawnpointPolice and spawnpointDrug And then use getElementsByType("spawnpointPolice") ... and bad argument Also tryed to put on lines of .map file the type data like these: <spawnpoint id="spawnpoint (12)"[b] type="police"[/b] skin="0" posX="975.92828369141" posY="1974.7801513672" posZ="15.487140655518" rotX="0" rotY="0" rotZ="0" /> type="police" on first fives and on the last fives type="drug" . and then use also getElementsByType("police") and also bad argument. can someone tell me how I can get them in groups ? using type.. something? thanks alot btw!! cya
-
Thats what I was wondering eheh thanks alot guys . cya
-
I understand it now Aibo!! if I put local variable outside of any scope ( function/if/else/for/while..) the variable will be just for that file, if is on some scope will be for that scope only . and if is global is for any .lua file of that resource I get that thanks! but I still have ONE QUESTION bro. you write this on the other topic: and testVar = "helo" will be a "global" variable for all script files in a resource (separated only by server/client side). U tell that is separated by server/client side ? I never understood that too.. a .lua file can have only function of the same side right ? .lua can only have client side functions or server side functions, not mixed? and if global variable is on client side functions file will only accessible for others client side functions file? is that what u mean? thanks!
-
Hm ok, and dont need to use any function to call it ? just use it with his name.. ? like it was in the same file? thanks for ur answer
-
hello guys, lately I have used much of my time in Lua Scripting and MTA, and I must say that I am enjoying alot the experience. All functions are in the wiki, and they all have a good tutorial on how to use them. Today I had to read a bit of lua manual and learned a few more things, I must now say that the lua is a language that is very good that I did not know, the mere fact of not having to define types is very good! I have been reading the section of the variables and found no answer to my problem, which is the following: a local variable is only recognized within a scope (this is a function, an if / else / elseif, for, while) right? on other side, a global variable is made by default, so for example "x = 5", is available anywhere in the file .lua, right? My question is: is it possible to access a global variable from another file .lua? Example Given: engine.lua: y = true hello = 2 and on lights.lua I want get the variable y which is declared as global in another file (in this case, engine.lua), it is possible? Thanks in advance, awaiting response
-
eheh thanks anyway bro