First person Script

All Lua scripting topics related to Multi Theft Auto.

Moderators: Scripting Moderators, Moderators, MTA Team

First person Script

Postby ksTakor on Fri Apr 12, 2013 1:32 pm

How can I make the weapon follow my crosshair in a First Person Script
Last edited by ksTakor on Sun May 05, 2013 10:07 am, edited 3 times in total.
ksTakor
Transformer
 
Posts: 70
Joined: Mon Mar 11, 2013 9:28 pm
Gang: D.A

Re: Slothman Firstperson Resource

Postby Adde on Sun Apr 14, 2013 12:27 pm

You can change it to a bind instead of a command i think. But if so, you have to edit the script.
My ingame nickname is: Mr.Snus
User avatar
Adde
Trick
 
Posts: 234
Joined: Mon Feb 11, 2013 5:17 pm
Location: Sweden
Gang: ZO:R (Backup)

Re: Slothman Firstperson Resource

Postby ksTakor on Sun Apr 14, 2013 1:40 pm

The camera starts when i start the resource it don't have a command.
ksTakor
Transformer
 
Posts: 70
Joined: Mon Mar 11, 2013 9:28 pm
Gang: D.A

Re: Slothman Firstperson Resource

Postby Adde on Wed Apr 17, 2013 1:46 pm

Okay, i haven´t tested this, but try to reset "fps.lua" with this. Then when script is started you should be able to do /fps to use firstperson. If it doesn´t work, just download the original script again or tell me the debug.

  1. checking = 0
  2. carchecking = 0
  3. wright = false
  4. wleft = false
  5. wback = false
  6. function FPSStart ()
  7.         local skin = engineLoadTXD ( "160.txd" ) -- arm skin
  8.         engineImportTXD ( skin, 160 )
  9.         local x,y,z = getElementPosition( getLocalPlayer() )
  10.         Body = createObject (991, x, y, z )
  11.         setElementParent(Body, getLocalPlayer())
  12.         attachElements ( Body, getLocalPlayer(), 0, -0.1, 0.45, 0, 90, 0)
  13.         setElementAlpha( Body, 0)
  14.         setElementData ( getLocalPlayer(), "blocker", Body )
  15.         realskin = getElementModel(getLocalPlayer())
  16.         if realskin == 160 then
  17.             realskin = 200
  18.         end
  19.         realvoice1, realvoice2 = getPedVoice (getLocalPlayer())
  20.         setElementModel ( getLocalPlayer(), 160 )
  21.         setPedVoice (getLocalPlayer(),realvoice1,realvoice2)
  22.         local allcars = getElementsByType ( "vehicle", getRootElement(), false)
  23.         for theKey,theVehicle in ipairs(allcars) do
  24.             setElementCollidableWith ( Body, theVehicle, false )
  25.         end
  26.         bindKey ( "left", "both", sidewalking )
  27.         bindKey ( "right", "both", sidewalking )
  28.         bindKey ( "backwards", "both", sidewalking )
  29.         bindKey ( "fire", "both", autoAimMode )
  30.        
  31.     end
  32. end
  33. addCommandHandler ( "fps", getRootElement(), FPSStart)
  34.  
  35. function clearcars()
  36.     if getElementType(source) == "vehicle" then
  37.         setElementCollidableWith ( Body, source, false )
  38.     end
  39. end
  40. addEventHandler( "onClientElementStreamIn", getRootElement(),clearcars)
  41.  
  42. function invisOnSpawn()
  43.     realskin = getElementModel(getLocalPlayer())
  44.     if realskin == 160 then
  45.         realskin = 200
  46.     end
  47.     realvoice1, realvoice2 = getPedVoice (getLocalPlayer())
  48.     setElementModel ( getLocalPlayer(), 160 )
  49.     setPedVoice (getLocalPlayer(),realvoice1,realvoice2)
  50. end
  51. addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), invisOnSpawn )
  52.  
  53. function climbcheck()
  54.     if isPlayerDead(getLocalPlayer())== false and getControlState("aim_weapon") == false then
  55.         setElementCollisionsEnabled(Body, false)
My ingame nickname is: Mr.Snus
User avatar
Adde
Trick
 
Posts: 234
Joined: Mon Feb 11, 2013 5:17 pm
Location: Sweden
Gang: ZO:R (Backup)

Re: Slothman Firstperson Resource

Postby ksTakor on Mon Apr 22, 2013 7:42 am

Thanks I gonna test.
ksTakor
Transformer
 
Posts: 70
Joined: Mon Mar 11, 2013 9:28 pm
Gang: D.A

Re: Slothman Firstperson Resource

Postby ksTakor on Mon Apr 22, 2013 7:32 pm

[Deleted]
Last edited by ksTakor on Mon Apr 29, 2013 8:43 am, edited 3 times in total.
ksTakor
Transformer
 
Posts: 70
Joined: Mon Mar 11, 2013 9:28 pm
Gang: D.A

Re: Slothman Firstperson Resource

Postby Adde on Tue Apr 23, 2013 1:46 pm

Hmm, I don´t know that :/ You should ask someone else about that or wait for someone to answear here.
My ingame nickname is: Mr.Snus
User avatar
Adde
Trick
 
Posts: 234
Joined: Mon Feb 11, 2013 5:17 pm
Location: Sweden
Gang: ZO:R (Backup)

Re: Slothman Firstperson Resource

Postby ksTakor on Tue Apr 23, 2013 1:48 pm

ok, but you know how to make that when i execute a command come back to third person?
ksTakor
Transformer
 
Posts: 70
Joined: Mon Mar 11, 2013 9:28 pm
Gang: D.A

Re: Slothman Firstperson Resource

Postby Adde on Tue Apr 23, 2013 3:18 pm

No sry, I just helped you a bit on the way.

You need something like this, but I don´t really know how to make it in this script.
  1. if (not isEnabled) then
  2.         isEnabled = true
  3.         addEventHandler ("onClientPreRender", root, updateCamera)
  4.         addEventHandler ("onClientCursorMove",root, freecamMouse)
  5.         radar = false
  6.     else --reset view
  7.         isEnabled = false
  8.         setCameraTarget (localPlayer, localPlayer)
  9.         removeEventHandler ("onClientPreRender", root, updateCamera)
  10.         removeEventHandler ("onClientCursorMove", root, freecamMouse)
  11.         radar = true
My ingame nickname is: Mr.Snus
User avatar
Adde
Trick
 
Posts: 234
Joined: Mon Feb 11, 2013 5:17 pm
Location: Sweden
Gang: ZO:R (Backup)


Return to Scripting

Who is online

Users browsing this forum: ALw7sH, Banex, Bing [Bot] and 5 guests