Jump to content

xScatta

Members
  • Posts

    181
  • Joined

  • Last visited

Everything posted by xScatta

  1. Zastąp w client triggerServerEvent("onMess",getLocalPlayer(),"Rozpocząłeś/aś pracę kierowcy śmieciarki! Udaj się do markera, oznaczonego różowym C na mapie.") Na triggerServerEvent("onMess",he,"Rozpocząłeś/aś pracę kierowcy śmieciarki! Udaj się do markera, oznaczonego różowym C na mapie.") Czasami są problemy z localPlayer i eventami pomiędzy serverem i clientem. Następnym razem rób to na polskim katalogu skryptowania.
  2. player = getLocalPlayer ( ) sw, sh = guiGetScreenSize ( ) mouse1_pressed = false FPS_CAMERA = false --FUNCTION MADE BY 'Doomed_Space_Marine', FIXED BY 'robhol' 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 addEventHandler ( "onClientCursorMove", getRootElement ( ), function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) if FPS_CAMERA and not isCursorShowing() and not isChatBoxInputActive() then local x1, y1, z1 = getPedBonePosition ( player, 6 ) lol1 = x2 lol2 = y2 lol3 = z2 l1, l2, l3, m1, m2, m3 = getCameraMatrix() end end ) addEventHandler ( "onClientPreRender", getRootElement ( ), function ( ) if FPS_CAMERA then local x1, y1, z1 = getPedBonePosition ( player, 6 ) local n, m, x3, y3, z3 = getCursorPosition() setCameraMatrix ( x1, y1, z1, lol1, lol2, lol3 ) end end ) --A SIMPLE WAY TO MAKE A KEY REPEATER --[[ bindKey ( "mouse1", "both", function ( k, state ) if state == "down" then mouse1_pressed = true else mouse1_pressed = false end end ) ]]-- --CONTROLS PART function resetControls ( ) --toggleControl ( "aim_weapon", not FPS_CAMERA ) --toggleControl ( "backwards", not FPS_CAMERA ) --toggleControl ( "sprint", not FPS_CAMERA ) --toggleControl ( "right", not FPS_CAMERA ) --toggleControl ( "left", not FPS_CAMERA ) --toggleControl ( "fire", not FPS_CAMERA ) --toggleControl ( "enter_vehicle", not FPS_CAMERA ) --toggleControl ( "enter_passenger", not FPS_CAMERA ) if FPS_CAMERA then else setElementAlpha ( player, 255 ) end end local x, y, z = getElementPosition(player) --DRAW A BEAUTIFUL CROSSHAIR IN THE MIDDLE OF THE SCREEN addEventHandler ( "onClientRender", getRootElement ( ), function ( ) if FPS_CAMERA then dxDrawImage ( ( sw / 2 ) - 4, ( sh / 2 ) - 4, 8, 8, "crosshair.png" ) end end ) addCommandHandler ( "fp", function ( ) FPS_CAMERA = not FPS_CAMERA if not FPS_CAMERA then setCameraTarget ( player ) else setCameraMatrix(x,y,z,0,0,3) end resetControls ( ) end ) The problem is when i move the camera don't stand still it moves so when i have camera at center then when i will change position then camera will try to look at position where the center WAS. CrystalMV said i must do something with 'roll' argument. Fast Reply please.
  3. Edited code... Still the same player = getLocalPlayer ( ) sw, sh = guiGetScreenSize ( ) mouse1_pressed = false FPS_CAMERA = false --FUNCTION MADE BY 'Doomed_Space_Marine', FIXED BY 'robhol' 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 --ALWAYS SET CAMERA POSITION IN THE PLAYER'S HEAD addEventHandler ( "onClientPreRender", getRootElement ( ), function ( ) if FPS_CAMERA then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1 ) if not getControlState ( "aim_weapon" ) then setControlState ( "aim_weapon", false ) end end end ) --MAKE SURE THE PLAYER AIMS WITH THE MOUSE addEventHandler ( "onClientCursorMove", getRootElement ( ), function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) if FPS_CAMERA then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) setElementRotation ( player, findRotation ( x1, y1, x2, y2 ),0,0 ) --setCursorPosition(sw/2,sh/2) end end ) --A SIMPLE WAY TO MAKE A KEY REPEATER bindKey ( "mouse1", "both", function ( k, state ) if state == "down" then mouse1_pressed = true else mouse1_pressed = false end end ) --CONTROLS PART function resetControls ( ) toggleControl ( "aim_weapon", not FPS_CAMERA ) toggleControl ( "backwards", not FPS_CAMERA ) toggleControl ( "sprint", not FPS_CAMERA ) toggleControl ( "right", not FPS_CAMERA ) toggleControl ( "left", not FPS_CAMERA ) toggleControl ( "fire", not FPS_CAMERA ) toggleControl ( "enter_vehicle", not FPS_CAMERA ) toggleControl ( "enter_passenger", not FPS_CAMERA ) if FPS_CAMERA then setElementAlpha ( player, 0 ) else setElementAlpha ( player, 255 ) end end --DRAW A BEAUTIFUL CROSSHAIR IN THE MIDDLE OF THE SCREEN addEventHandler ( "onClientRender", getRootElement ( ), function ( ) if FPS_CAMERA then dxDrawImage ( ( sw / 2 ) - 4, ( sh / 2 ) - 4, 8, 8, "crosshair.png" ) end end ) addCommandHandler ( "fp", function ( ) FPS_CAMERA = not FPS_CAMERA if not FPS_CAMERA then setCameraTarget ( player ) end resetControls ( ) end ) Is strange because in previous versions it was working but now nope. And the camera matrix direction is 0, 0, 0 position and its relative to player position so when i move then the camera direction is the 0, 0, 0 position.
  4. I never steal... Look at my first post in this topic Edit: I was thinking you are talking about me
  5. @xXMADEXx player = getLocalPlayer ( ) sw, sh = guiGetScreenSize ( ) mouse1_pressed = false FPS_CAMERA = false --FUNCTION MADE BY 'Doomed_Space_Marine', FIXED BY 'robhol' 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 --ALWAYS SET CAMERA POSITION IN THE PLAYER'S HEAD addEventHandler ( "onClientPreRender", getRootElement ( ), function ( ) if FPS_CAMERA then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1 ) if not getControlState ( "aim_weapon" ) then setControlState ( "aim_weapon", false ) end end end ) --MAKE SURE THE PLAYER AIMS WITH THE MOUSE addEventHandler ( "onClientCursorMove", getRootElement ( ), function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) if not isChatBoxInputActive ( ) and FPS_CAMERA then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setPedRotation ( player, findRotation ( x1, y1, x2, y2 ) ) setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) end end ) --A SIMPLE WAY TO MAKE A KEY REPEATER bindKey ( "mouse1", "both", function ( k, state ) if state == "down" then mouse1_pressed = true else mouse1_pressed = false end end ) --CONTROLS PART function resetControls ( ) toggleControl ( "aim_weapon", not FPS_CAMERA ) toggleControl ( "backwards", not FPS_CAMERA ) toggleControl ( "sprint", not FPS_CAMERA ) toggleControl ( "right", not FPS_CAMERA ) toggleControl ( "left", not FPS_CAMERA ) toggleControl ( "fire", not FPS_CAMERA ) toggleControl ( "enter_vehicle", not FPS_CAMERA ) toggleControl ( "enter_passenger", not FPS_CAMERA ) if FPS_CAMERA then setElementAlpha ( player, 0 ) else setElementAlpha ( player, 255 ) end end --DRAW A BEAUTIFUL CROSSHAIR IN THE MIDDLE OF THE SCREEN addEventHandler ( "onClientRender", getRootElement ( ), function ( ) if FPS_CAMERA then dxDrawImage ( ( sw / 2 ) - 4, ( sh / 2 ) - 4, 8, 8, "crosshair.png" ) end end ) addCommandHandler ( "fp", function ( ) FPS_CAMERA = not FPS_CAMERA if not FPS_CAMERA then setCameraTarget ( player ) else end resetControls ( ) end ) Why don't it work now? @YOGA I want this script not yours... I came here to repair this script.
  6. First line player = getLocalPlayer ( )
  7. Hi. The script is not mine but i have a problem with it. Client: player = getLocalPlayer ( ) sw, sh = guiGetScreenSize ( ) mouse1_pressed = false FPS_CAMERA = false --FUNCTION MADE BY 'Doomed_Space_Marine', FIXED BY 'robhol' 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 --ALWAYS SET CAMERA POSITION IN THE PLAYER'S HEAD addEventHandler ( "onClientPreRender", getRootElement ( ), function ( ) if FPS_CAMERA then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1 ) if not getControlState ( "aim_weapon" ) then setControlState ( "aim_weapon", false ) end end end ) --MAKE SURE THE PLAYER AIMS WITH THE MOUSE addEventHandler ( "onClientCursorMove", getRootElement ( ), function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) if not isCursorShowing ( ) and not isChatBoxInputActive ( ) and not isMainMenuActive ( ) and FPS_CAMERA then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setPedRotation ( player, findRotation ( x1, y1, x2, y2 ) ) setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) end end ) --A SIMPLE WAY TO MAKE A KEY REPEATER bindKey ( "mouse1", "both", function ( k, state ) if state == "down" then mouse1_pressed = true else mouse1_pressed = false end end ) --CONTROLS PART function resetControls ( ) toggleControl ( "aim_weapon", not FPS_CAMERA ) toggleControl ( "backwards", not FPS_CAMERA ) toggleControl ( "sprint", not FPS_CAMERA ) toggleControl ( "right", not FPS_CAMERA ) toggleControl ( "left", not FPS_CAMERA ) toggleControl ( "fire", not FPS_CAMERA ) toggleControl ( "enter_vehicle", not FPS_CAMERA ) toggleControl ( "enter_passenger", not FPS_CAMERA ) if FPS_CAMERA then setElementAlpha ( player, 0 ) else setElementAlpha ( player, 255 ) end end --DRAW A BEAUTIFUL CROSSHAIR IN THE MIDDLE OF THE SCREEN addEventHandler ( "onClientRender", getRootElement ( ), function ( ) if FPS_CAMERA then dxDrawImage ( ( sw / 2 ) - 4, ( sh / 2 ) - 4, 8, 8, "crosshair.png" ) end end ) addCommandHandler ( "fp", function ( ) FPS_CAMERA = not FPS_CAMERA if not FPS_CAMERA then setCameraTarget ( player ) else resetCamera ( ) end resetControls ( ) end ) The only problem here is when i move the mouse the camera doesn't move. Fast reply please. Greetz. xScatta
  8. @theVenom dxDrawImage ( float posX, float posY, float width, float height, mixed image [, float rotation = 0, float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0, int color = tocolor(255,255,255), bool postGUI = false ] ) float rotation = 0, float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0 Just use the rotation.
  9. getElementPosition -- get position of car getScreenFromWorldPosition -- get screen position from position of car https://wiki.multitheftauto.com/wiki/onClientRender -- render the image dxDrawImage -- draw the image using the getScreenFromWorldPosition with car position and rotation to make it flat
  10. Hey all i have a problem because when i create object and attach it to player then i detach it and the object is not in the position how i seen it attached so how to get attached position? not the position at attach because when i get position of the object i get the position where i attached it not that i see attached.
  11. Just don't use 'root' use then getRootElement()
  12. But i mean to remove event handler from function "builded" in event handler not outside. just like that Correct addEventHandler(...,...,function () ... end) - - - - - - - - - Bad addEventHandler(...,...,FunctionName) And i want to remove event handler from the Correct version.
  13. Hey Guyz. I have a question look at the code. addEventHandler(EventName5,ElementAttached8,function () ... ) and i want to do something like this removeEventHandler(EventName5,ElementAttached8,PROBLEM) in PROBLEM how can i specify the function if i don't do another function outside event handler?
  14. Hey all i have a question. So i put things in table like that table = {vehicle, player1, vehicle8, player9} -- so i want to do something LIKE that table.remove(table,vehicle8) -- btw theres so many things in table this is only example And i don't know how to make something like this BUT working. Anyone help please. Or if it is possible to GET position of element in table.
  15. How we can help you if you don't posted the code...?
  16. Screeny Ip podam dopiero po skype bo nie chce nie ogarów dlatego muszę z każdym porozmawiać Screeny trochę ucieło dlatego żeby zobaczyć cały trzeba kliknąć "Otwórz grafikę w nowej karcie"
  17. Cześć z tej strony xScatta, a więc tak z kilkoma kolegami założyliśmy serwer naszym celem, który jest prawie skończony jest. Roleplay taki z własnymi zasadami wszyscy gramy normalnie bez wyzwisk sami(my i wy)wybieramy miasto(a) Roleplay i jak dobrze pójdzie to jedno rozegranie Roleplay idzie kilka dni pozatym u nas jedynym limitem jest 1. W miarę ogarnięte Roleplay ( no przynajmniej rozumowanie /me i podstaw ). 2. Skype z mikrofonem. 3. Minimalnie 10 lat. (ustaliłem to, ponieważ nie spotkałem nigdy kogoś, kto ogarnia a posiada poniżej 10 lat ) W razie pytań czy chęci dołączenia piszcie na skype: piotrdawno Pozdrawiam xScatta PS. Wszystkie skrypty takie jak system domów i aut itd. zostały już zrobione przeze mnie. ( jeżeli chcecie ss'y ze skryptów to napiszcie )
  18. @Wielebny tak, to będzie open-source. Sam tak myślę, że większość "ludu" robi wszystko w tajemnicy i, jak już ma pomysł ( i motywację ) to raczej nie da tego pomysłu nikomu, kto dałby radę otworzyć własny serwer. @Piorun taki jest problem, bo całego Tokyo nie mamy, ale, za to mieliśmy pomysł zwerbować kolejnych modelerów do pomocy. Każde ręce do pracy się przydadzą. PS. Jeżeli chcecie żebym napisał co mamy, to śmiało piszcie. @Piorun podmianki nie ważą więcej niż 100mb, jak dobrze kojarzę.
  19. Witam was wszystkich chciałbym zapytać czy jest ktokolwiek, kto, by chciał pomóc ( wynagrodzenia pieniężnego nie będzie liczę na "przyjacielską" pomoc po prostu dana osoba dostanie powie, czego oczekuje ) w projekcie ( Tokyo Roleplay ) powiem tak w Lua z MTA umiem wszystko, oprócz tego MySql itd. bo tego nigdy nie dotykałem. I nie myślcie tak, że nie ma całego serwera a szukam skryptera i wszystko z community, bo gamemode jest już przy końcu a szukam kogoś, kto też, by chciał pomóc w tym jakże unikalnym gamemod'zie. ( Szczegóły na Priv jak coś, jeżeli ktoś będzie chętny do pomocy ). Logo z serwera Pozdrawiam, xScatta
  20. Opisał byś może problem?
  21. xScatta

    don't work!

    This would work like you want. NameT = "SC Life" vehTeam = { [ 411 ] = true, [ 402 ] = true } function enterVehicle ( thePlayer, seat, jacked ) if ( getElementType ( thePlayer ) == "player" ) then local team = getPlayerTeam ( thePlayer ) local teamName = ( team and getTeamName ( team ) or "" ) if ( teamName == NameT ) then if ( vehTeam [ getElementModel ( source ) ] ) then outputChatBox ( "vehicle from: ".. NameT, thePlayer, 255, 255, 0, true ) else outputChatBox ( "you can't use this", thePlayer, 255, 255, 0, true ) removePedFromVehicle(thePlayer) end end end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle )
×
×
  • Create New...