Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. @Anderl, do you think this event will work? I never used the Event "onPlayerReachCheckpoint".
  2. yes, client. But I hate f*ck client. I script server. ahh removed your post....
  3. Since when is onPlayerReachCheckpoint client side O_o setElementRotation(localPlayer, x1, x2, x3(localPlayer)) heh????? function warphigh(checkpoint, time) local x, y, z = getElementPosition (source) setElementPosition (source, x, y, z+20) setPlayerRotation (source, getPlayerRotation (source)) end addEvent('onPlayerReachCheckpoint') addEventHandler('onPlayerReachCheckpoint', getRootElement(), warphigh)-- NO >() maybe getRootElement() must be root, but I am not sure... function warphigh(checkpoint, time) local x, y, z = getElementPosition (source) setElementPosition (source, x, y, z+20) setPlayerRotation (source, getPlayerRotation (source)) end addEvent('onPlayerReachCheckpoint') addEventHandler('onPlayerReachCheckpoint', root, warphigh)-- NO >()
  4. Not really, but there is something called: https://wiki.multitheftauto.com/wiki/ProcessLineOfSight
  5. addEvent('onPlayerReachCheckpoint') addEventHandler('onPlayerReachCheckpoint', getRootElement(), function (checkpoint,time)-- if needed checkpoint,time local x, y, z = getElementPosition (source) setElementPosition (source, x, y, z+20) setPlayerRotation (source, getPlayerRotation (source)) end) --"warphigh(source)" why? I have never worked with it but here in Russian: https://wiki.multitheftauto.com/wiki/RU/Resource:Race
  6. IIYAMA

    table.remove

    (weaponObjectsVeh)[1] = weaponObjectsVeh theVehicle = v[1] attached to the vehicle. weapon1=v[2] weapon2=v[3] I can't check a "table" if it is an element. When the vehicle get removed(gone) this filter will remove the weapons from the vehicles. The server table and the client together are working with the same data. Why I work with tables instead of element data is that I can decide when I send data to those players. If a player is in the spawn menu, he should start downloading new data at moments he really joins other players. Also when they are doing a minigame, it isn't necessary to download those data. Thank you again.
  7. IIYAMA

    table.remove

    aha got it, thank you server for i,vehicle in ipairs (weaponObjectsVeh) do while weaponObjectsVeh[ i ] and not isElement(weaponObjectsVeh[ i ]) do table.remove(weaponObjectsVeh,i) end end client for i, v in ipairs (weaponObjectsVeh) do --if not isElement(v[1]) then while weaponObjectsVeh[ i ] and not isElement( (weaponObjectsVeh[i])[1] ) do local vehicle2,weapon1,weapon2 = unpack(weaponObjectsVeh[i]) destroyElement (weapon1) if isElement(weapon2) then destroyElement (weapon2) end table.remove(weaponObjectsVeh,i) end end can it be smaller? because I call this index like 4x.
  8. IIYAMA

    table.remove

    I forgot this: my element I need to check is here: v[1] v[2] = weapon1 v[3] = weapon2 element, weapon1, weapon2 = unpack(v) is this possible? (myTable[ i ])[1]
  9. IIYAMA

    table.remove

    for i, v in ipairs ( myTable ) do while myTable[ i ] and not isElement( v[i ] ) do table.remove( myTable, i ) end end btw my element I need to check is here: v[1] v[2] = weapon1 v[3] = weapon2 element, weapon1, weapon2 = unpack(v) like this? Note: while is dangerous stuff, even my intel boxed can crash of it....
  10. IIYAMA

    table.remove

    Well I think I let the inpairs loop twice,
  11. IIYAMA

    table.remove

    airplanes_weapon\server.lua:58 Aborting; infinite running script in airplanes_weapons but it will go on for ever.
  12. IIYAMA

    table.remove

    But it will still skip some data?
  13. IIYAMA

    table.remove

    I have a problem with removing data from a table. When I use table.remove the table will automatic change. Sample: local A = createObject(...,...,...,..) local B = createObject(...,...,...,..) local myTable = {A,2,8,B} for i, v in ipairs (myTable) do if not isElement( vehicle ) then table.remove(myTable,i) end end When I do this: -- {A,2,8,B} -- First loop A won't be removed because it is an element. Next 2 is a number so will be removed. (i=2)* 8 will be at location [2] because of table.remove(myTable,i=2)*. But 8 since is there.... he won't remove Index during table.remove What is the best way to solve this?
  14. IIYAMA

    Help please

    Well I am very interesting in weapon syncs so, yes I did try. I tried the easy way, the way without all those special lines for locating the sniper. --client addEventHandler ( "onClientRender", root, function () if getControlState ("aim_weapon" ) then if getPedWeapon (getLocalPlayer ())== 34 then setControlState ( "zoom_out", true )--zoom_in.... -_-" setControlState ( "aim_weapon", true) end end end) but it worked out very strang, I am not sure if the same happens to you. First I added zoom_in, but some how this script zoomed out... so I used zoom_out instead... and this ..... script started to zoom in for me. wtf! ------------------ but a harder way: --server setWeaponProperty(34,"pro","flags",0x000008) --client addEventHandler ( "onClientRender", root, function () local player = getLocalPlayer () if getPedWeapon (player)== 34 then if getControlState ("aim_weapon" ) then local xs, ys, zs = getPedWeaponMuzzlePosition ( player ) local xe, ye, ze = getPedTargetEnd(player) --getPedRotation(player) setCameraMatrix ( xs, ys, zs, xe, ye, ze) setControlState ( "aim_weapon", true) dxDrawLine3D ( xs, ys, zs, xe, ye, ze, tocolor(255,0,0,255), 1, false, 1 ) elseif getCameraTarget (player)~= player then setCameraTarget ( player ) end end end) ------------- --server setWeaponProperty(34,"pro","flags",0x000008) --client addEventHandler ( "onClientRender", root, function () local player = getLocalPlayer () if getPedWeapon (player)== 34 then if getControlState ("aim_weapon" ) then --if getControlState ("fire" ) then local xs, ys, zs = getPedWeaponMuzzlePosition ( player ) local xe, ye, ze = getPedTargetEnd(player) --getPedRotation(player) --setCameraMatrix ( xs, ys, zs, xe, ye, ze) -- setControlState ( "aim_weapon", true) dxDrawLine3D ( xs, ys, zs, xe, ye, ze, tocolor(255,0,0,255), 1, false, 1 ) -- elseif getCameraTarget (player)~= player then --setCameraTarget ( player ) -- end local x, y, z, lx, ly, lz = getCameraMatrix() if x and y and lx and ly then local zc = findRotation(x,y,lx,ly) setElementRotation(player,0,0,zc) end end end end) -- source wiki mta >> function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end --<< It does not work even 40%, many bugs etc. -_-" If you really wanna have this you have to ask your pcp mates, they seems to have good scripters. You are from the bomb da base server right?
  15. @Billy Zou ik ook niet weet bij jou, "geen locatie". Deze vond ik ook al geniaal toen ik mijn nieuwen pc in elkaar had gezet.
  16. IIYAMA

    tonumber?

    ok,
  17. IIYAMA

    tonumber?

    ok, skipper nice sample @tosfera local loan = givePlayerMoney(hitPlayer, money) -- money = an int triggerClientEvent(source, "errorMsg", root, "Well done! I'll give you: $".. tostring(money)) -- now its a string But why should it need to be a string? A word or letter can already be a number. tonumber(loss) -- loss is already a number.
  18. IIYAMA

    tonumber?

    Source: http://www.lua.org Give me a sample, because I have never put something in to a "string" I think.
  19. IIYAMA

    tonumber?

    What can you do with tonumber? Because I have never needed it before.
  20. Maybe one more byte looping through the script
  21. When you leave GTA san, there will be some bugs, this is just one of them. and more: (as far I know those aren't fixed or not able to be fixed) - Pickups become invisible. (not custom pickups from race, those are objects not real pickups) - Water creation don't work there. etc. This bug can't be fixed. I use my own version of server syncs thx to Phat Looser, so I don't have problems with this bug.
  22. but pairs is better when you don't need that number?
  23. Will it give lagg when I use ipairs instead of pairs at moments, I don't need to know the location of the source? short:(lagg?) I have a table but I don't need the iteration number, while using ipairs.
  24. IIYAMA

    question

    So it is possible to know the camera position from other players without using server side?
  25. IIYAMA

    Help please

    Possible to make, but I can promise you it isn't 20 line's of code. everything is possible :3
×
×
  • Create New...