-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
@Anderl, do you think this event will work? I never used the Event "onPlayerReachCheckpoint".
-
yes, client. But I hate f*ck client. I script server. ahh removed your post....
-
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 >()
-
Not really, but there is something called: https://wiki.multitheftauto.com/wiki/ProcessLineOfSight
-
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
-
(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.
-
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.
-
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]
-
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....
-
Well I think I let the inpairs loop twice,
-
airplanes_weapon\server.lua:58 Aborting; infinite running script in airplanes_weapons but it will go on for ever.
-
But it will still skip some data?
-
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?
-
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?
-
@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.
-
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.
-
Source: http://www.lua.org Give me a sample, because I have never put something in to a "string" I think.
-
What can you do with tonumber? Because I have never needed it before.
-
Maybe one more byte looping through the script
-
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.
-
but pairs is better when you don't need that number?
-
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.
-
So it is possible to know the camera position from other players without using server side?
-
Possible to make, but I can promise you it isn't 20 line's of code. everything is possible :3
