Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 26/08/21 in all areas

  1. My question to some extent walks the line, in what would be considered a scripting question. However given the nature of this platform and MTA SA I think a greater understanding of this topic would be extremely valuable to many. As math forms the basis for the foundations of a great deal of things within video games in general, to avoid moving into TLDR territory. My question is pretty simple I've placed markers plotting a path, around the Las Ventures Airport. (See the map below for a reference) A car is placed south near the AT-400 hangar, and the points are order in a fashion that if each are followed sequentially. The car will loop this runway endlessly without human intervention. From what I am aware the execution would function something like this. in dot points. 1. The car would check all points and select the one that is closest to the position of the vehicle.(Thus the car would proceed north towards the left turn) 2. The second stage would be setting orientation. Step 2 is really were the problems stands for me personally how would the orientation system work. How would this be done and what form of math would allow for that. Generally what materials would be worth studying that could be useful in dealing with these issues?
    1 point
  2. local zCoordinates = { {-2411.49, -608.29, 131.62, 18.33, 12.49, 1.92}, {-2430.09, -607.45, 131.56, 5.55, 7.24, 1.90} } local zones = {} for i,v in ipairs(zCoordinates) do local theZone = createColCuboid(zCoordinates[i][1], zCoordinates[i][2], zCoordinates[i][3], zCoordinates[i][4], zCoordinates[i][5], zCoordinates[i][6]) table.insert(zones, theZone) end addEventHandler("onColShapeHit", root, function(element) for i=1,#zones do if(source == zones[i]) then if getElementType(element) == "ped" or getElementType(element) == "player" or getElementType(element) == "vehicle" then if getElementAlpha(element) == 255 then setElementAlpha(element, 130) setElementCollisionsEnabled(element, false) end end end end end) addEventHandler("onColShapeLeave", root, function(element) for i=1,#zones do if(source == zones[i]) then if getElementType(element) == "ped" or getElementType(element) == "player" or getElementType(element) == "vehicle" then if getElementAlpha(element) == 130 then setElementAlpha(element, 255) setElementCollisionsEnabled(element, true) end end end end end) try this
    1 point
  3. Of course it can be made to work! In the past weeks I have been working on an optimal internal representation and calculation dependency graph system for the compiler. I am doing good progress on that part and I want to share some internal details I have set on so far. (Lua to 80386 machine model example - graphs post - Imgur) Let's try to compile a very simple Lua program and you will see that it is not such a big deal. local value value = 1 + 1 print( value ) return value If we lex the program into our compiler we can obtain the following graph (pure language structure): There you see that we have created internal objects for each language structure. Each node that you see in the graph above is a memory-allocated object in a programming language. Our language target is C++ which is very fast and powerful, especially in the latest standard. Our next step is to schedule the graph into an operation order: Now we have assigned each opcode a natural number so the processor would know in what order to assign so called "instructions". This is important because each program is defined to be a strict sequence of instructions. Now that we have such an order we know in what regions which variables are used inside the program. Thus we know what registers to assign between which operations so that they do not collide. Take a look at this possible 80386 machine model example: This model is just an example hence not yet detailed enough but it should give you a general idea about the feasibility of the compiler. The programs that result from this compilation can be packaged into PE files or into other formats that support electronic signatures. I hope that I could convince you of my methods! --- From the above example you can deduce the required components for this task: lexer, computation graph and transformation rules. I am currently working on the lexer.
    1 point
  4. Hey, for plane to show from both sides, you will need to duplicate the polygons and then flip their normals. Alternatively through map editor you can enable the object property Double-sided to get the same effect. This setting can be useful if you don't want to increase DFF size by duplicating polygons. As for the wires not rendering very far, try enabling or disabling Anti-aliasing using Magic TXD.
    1 point
  5. weed = {} -- creamos una tabla para almacenar las compras function buyWeed () local money = getPlayerMoney( source ) if not weed[source] then -- comprobamos que no tengo una compra ya hecha if money >= 180 then local player = source weed[player] = true -- añadimos la compra a la tabla setPedAnimation(player ,"DEALER", "shop_pay") takePlayerMoney(player, 180) animTimers[player] = setTimer(startSmokingWeed,4500, 1, player) else outputChatBox( "Vuelve cuando tengas el dinero",source,200,0,0) end else outputChatBox( "Ya compraste weed",source,200,0,0) end end addEvent("buyWeed", true) addEventHandler("buyWeed", root, buyWeed) function startSmokingWeed(player) weed[player] = nil -- en tu funcion startSmokingWeed añade esta linea que elimina la compra end
    1 point
  6. Então não tentou o suficiente. function handleVehicleDamage (attacker, weapon, loss, x, y, z, tire) if (weapon == 51) then -- Se recebeu dano por uma explosão (granada, carro explodindo próximo, etc), então: cancelEvent() -- Cancela o dano. (o veículo ainda pode quebrar partes normalmente, mas não vai perder vida) end end addEventHandler ("onClientVehicleDamage", root, handleVehicleDamage)
    1 point
×
×
  • Create New...