Wojak
Members-
Posts
321 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Wojak
-
i did not pay attention on math well enough to know that... (this code is 90% wiki exemple) but ive used it to: -recalculate speed vector acording to rotation -calculating the ring marker target, based on dummy element rotation -calculating the relative teleportation coordinates in my teleporteditor script, and it works just like i want - its good enough to me
-
getElementMatrix function? it allow to calculate offset points bypassing alot of math, but it only works clientside for peds (including player) and vehicles function getOffsetPoints(element,x,y,z) local matrix = getElementMatrix ( element ) local offX =x * matrix[1][1] + y * matrix[2][1] + z * matrix[3][1] + 1 * matrix[4][1] local offY = x * matrix[1][2] + y * matrix[2][2] + z * matrix[3][2] + 1 * matrix[4][2] local offZ =x * matrix[1][3] + y * matrix[2][3] + z * matrix[3][3] + 1 * matrix[4][3] --Return the transformed point return offX, offY, offZ end using getOffsetPoints(vehicle,0,10,0) you will get a point located 10m in front of the vehicle no matter the rotation using getOffsetPoints(vehicle,0,0,5) you will get the point 5 m above using getOffsetPoints(vehicle,0,0,-5) you will get the point 5 m below
-
It has nothing to do with streaming, vehicles that are located more than 140 m from any player are not synced, even if it is still moving, the movment is lical, and the position for the server is not updated, when the vehicle get close enough to a player again, it vill jump to last synced position.
-
Problems that might be usefull to others if answered...
Wojak replied to will briggs's topic in Scripting
1. you need to edit the gamemodes, so that they will handle only selected players, it is not easy, but you may start by changing the type from gamemode to script, ass you can run only one gamemode at the same type 2. create the element client side, clientside elements only exist on clients that they've been cteated on -
This may work with one player on the server, but most likely result with high ping or timeout. if there will be more than one client on the server, events will multiply and crach the server, not to mention the data conflict, if somehow the coordinates on each client will be diferent
-
function onresourceStart is created in anonymus function that is caled on resource start and "onClientResourceStart" event is triggered only once for the current resource. conclusion: function onresourceStart is never triggered, and F9 key is never binded...
-
i need this function for the race mode... i don't think that when the player spawns in the vehicle the onVehicleEnter event will be called... it will, and it's sure as hell better to use onVehicleEnter instead of onPlayerSpawn for the 'race' gamemode. When you die and respawn in race, your player actually doesn't die... Its position will be somewhere up in the sky so he will never "respawn" again hence onPlayerSpawn won't be triggered everytime you respawn in race hmm, so how come my script, that displays player spawn on deathmessage works every time? (it uses event onPlayerSpawn) you can see it on this video on 07:12:
-
its not a bug, its a MTA sync limit (100m for peds, 140 for vehicles) even if someone will "fix" this, you wont find a server that will handle it...
-
addEventHandler ( "onResourceStart", getRootElement(), pedLoad ) Najprawdopodobniej funkcja wykonuje się przy starcie każdego zasobu na serwerze... getRootElement() można zastąpić getResourceRootElement(getThisResource()) albo w ogóle zrezygnować z eventa i stworzyć peda po za jakąkolwiek funkcją, na początku skryptu co do animacji, spróbuj ustawić ją z opóźnieniem setTimer
-
getVehicleTowingVehicle
-
guiSetAlpha setTimer bindKey
-
yes, this looks like something that may crash the server... it uses moveObject serverside, this is very easy to controll, and looks good (but not perfect) @TheGhost, if you want to use some part of the code, at lest give me credit, but controll state will make it look more natural client only function...
-
assuming you using dxDrawImage function, if your image is a square width = size height = size if its a rectangle than for exemple: width = size*2 height = size to calculate size you need a constant number (for exemple 50) this number is a size of the imahe, when you are next to it, you will need to experiment with it wo calculate the distance you need: x,y,z = world position of the image (get position of the thing the image is attached to) px,py,pz = getElementPosition(getLocalPlayer()) distance = getDistanceBetweenPoints3D(x,y,z,px,py,pz) so the formula will be: size = 50/distance (you may need to change 50 to something else)
-
he wants to create "3D" image that has the same size regardless to distance ftom the player to create this illusion you need to scale (change size) the image based on the distance from the player, the formila is: size = (some constant number)/distance
-
https://wiki.multitheftauto.com/wiki/OnClientGUIAccepted
-
so you people really want to learn? ok, first - what is programing/ scriptnig? no big secret here, you jost tell the computer whot to do, and it follows youre every order without a question, but un like human it can not think for himself, so you need to predict EVERYTHING that may hapen during the script runtime, and you need to follow a strict syntax now the lua: first read Part I from 1 to 7: http://www.lua.org/pil/index.html - that's lua basics than the library - Part III from 18 to 20 more about library: http://www.lua.org/manual/5.1/#index focuse on basic, math, string and table and finaly you can go to MTA wiki and read as follow: https://wiki.multitheftauto.com/wiki/Meta.xml https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Debugging https://wiki.multitheftauto.com/wiki/Client_side_scripts https://wiki.multitheftauto.com/wiki/Element_tree https://wiki.multitheftauto.com/wiki/Event_system https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI https://wiki.multitheftauto.com/wiki/Resources https://wiki.multitheftauto.com/wiki/Writing_Gamemodes and MTA library: https://wiki.multitheftauto.com/wiki/Cli ... _Functions https://wiki.multitheftauto.com/wiki/Cli ... ing_Events https://wiki.multitheftauto.com/wiki/Ser ... _Functions https://wiki.multitheftauto.com/wiki/Ser ... ing_Events than you can go back to programing manual and read the rest. Congratulations, you are now an expert! EDIT and if someone thinks, that there is an easy way- no comment...
-
@bmat - what do you mean by basic lessons and advanced lessons, can you write some specyfic stuff? - also where did you learn lua, what is wour experience? - and ofcourse, you will teach raw lua, or mayby MTA oriented lua? (there is more than just lua to learn, when you want to script something for MTA)
-
im planning to implement something like that it to some of my resources, and maybe later a independent version. I already have a code for rectangle, but i want to make suport for all colshapes, so it will not be relesed soon. So you must be patient for few months, or do it yourself... http://img293.imageshack.us/img293/9261 ... 201704.jpg http://img219.imageshack.us/img219/6213 ... 202038.jpg
-
ipirs() is an iterator function that only work for tables indexed by numbers starting from 1, it also sort the indexes while looping thru them, but it will not work if a index skip a number, for exemple: local table = { [2]="b", [3]="b",[1] = "a" } "for" will loop thru all 3 cells local table = { ,[2]="b", [4]="b",[1] = "a" } "for" will stop on 2 cell if you want to loop tabels indexed by eny data type (including elements) you should use "pairs()" in expresion for key, var in (i)pairs(sometable) do key will contain the index var will contain the value of the cell
-
oh, sorry for the unnecessary information, if you want to disable colisions within one colshape, you only need the "client who hit/leave the colshape part", that is: -turn off colisions for every player except the local player on a client who hit the colshape using setElementCollisionsEnabled or - turn off colision between local player and all other players using setElementCollidableWith whole thing may be clientside (onClientColshapeHit/leave) you need to play around with the other clients only if you for example want to disable using one colshape and enable using other...
-
using setElementCollidableWith you must: on a client who hit the colshape- turn off colision between local player and all other players on other all clients- turn off colision between local player and the player who hit the colshape
-
what to understand? it's clear that he want to trick scripters to make a script for him...
-
to turn off collisions for a player you need to turn off colisions for every player except the player who hit the colshape clientside on a client who hit the colshape, and turn off the colisions for player who hit the colshape on every other client, this may be a little confusing, but read my post over and over until you understand it
-
if alpha = 0 than image is invisible, try tocolor ( 0, 0, 0, 100 )
-
why the hell he would try to use some weird exported funcion, if he just could use createObject? createObject will not create a entry in a map file, that could be saved in map editor... @H5N1 do your resource has an EDF file? or do you simply want to create a default obiect? try "editor_main" instead of "toolbox"