-
Posts
1,089 -
Joined
-
Last visited
Everything posted by Xwad
-
What could be the problem??
-
Its not working:/ Bad usage @ 'onClientRender' ['onClientRender' with this function is already handled'] function onExit(theElement) removeEventHandler("onClientRender", getRootElement(), rotate) end function bindFire () addEventHandler("onClientRender", getRootElement(), rotate) end addEvent( "bindFire", true ) addEventHandler( "bindFire", localPlayer, bindFire ) function rotate() setElementRotation(weapon, 0, 3.2, 96.92 - getPedCameraRotation(localPlayer)) setElementRotation(localPlayer, 0, 0, 0 - getPedCameraRotation(localPlayer)) end
-
Hi. Is it possible to add an event in a function like this? I mean that the event will only be activated when the function starts, and will not work until i enter the command. Function event (commandName) addEventHandler ("onClientPlayerVehicleEnter", root, function) End addCommandHandler ("test", event)
-
PLSSSS HELPP!!! THIS IS THE LAST THINK I NEED TO FINISH MY SCRIPT!!!!!!(((((((((((
-
What? I dont understand it very well. What should i do now with y amd z axis?
-
Hi i made a script that makes possible if a player rotate his camera then the weapon will rotate to the same direction. I have only one problem.. the weapon is only rotating to left and right. Its not rotating up and down:/ i mean, forexample if i rotate the camera to the right or to the left then the weapon will rotate to the same direction. But when i look up and down then the weapon is not rotating up and down. Pls help local test = createWeapon("m4", -2388.41,-581.15, 132.3)setWeaponState(test, "ready") function rotate () setElementRotation(test, 0, 3.2, 96.7 -getPedCameraRotation(localPlayer)) end addEventHandler ("onClientRender", root, rotate) function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or tend
-
Why is it not rotating up and down? pls help setElementRotation(test, 0, 3.2, 96.7 - getPedCameraRotation(localPlayer))
-
no its not working correctly:( the weapon is rotating pell-mell
-
its not working correctly. the weapon is fully rotated now and the rotating is always the opposet but wait i test it again
-
sry sry sry its working i just changed the values now!! now its not moving to the left!! i changed this from this : setElementRotation(test, 0, 0, 360 - getPedCameraRotation(localPlayer)) to this: setElementRotation(test, 0, 3.2, 96.7 - getPedCameraRotation(localPlayer)) Thanks man that you are helping me im really grateful!! But i have one more problem!! When i look up and down with the camera then the weapon is not rotating up and down!!
-
setElementRotation(test, 0, 0, getPedCameraRotation(localPlayer)) Actualy its working but not correctly again:/ When i use this one then the weapon is always rotating to the opposite side.. I mean if i look with the camera to the right side then the weapon will rotate to the left side.. :setElementRotation(test, 0, 0, 360 - getPedCameraRotation(localPlayer)) This one is rotating correctly but this has also a problem.. when i put this line to a function and start the function the then weapon is looking to the right automaticly and i cant rotate it..Please help
-
Now theres no error but its not working correctly:// The weapon is not rotating to the direction where the camera is looking
-
Thanks Army@1!! Its still not working but theres no more error with setElementRotation, only a bad argumentum: lua:10: Bad Argumentum @ 'setElementRotation' [Expected number at argumentum 3, got none] Whats could be the problem now?
-
I changed the source to localPlayer. Its good now , but yeah theres still the error with the findRotation.. So its not defined? thats why its not working? So what should i do to fix that problem? Thanks.
-
I forgot to say that its client sided!!! I tryed but its the same error:/
-
Hi. I made a script that makes possible if i rotate the players camera to the right then the object will also rotate right. I mean that the object is rotating to that direction , where the players camera is looking. The only problem is that its not working.. Debugscript: lua:7: Bad Argumentum @ 'getElementRotation' [Expected element at argumentum 1,got nil] lua:8: Bad Argumentum @ 'getElementPosition' [Expected element at argumentum 1,got nil] lua:10: attempt to call global 'findRotation' (a nil value) Client.lua local test = createWeapon("m4", -2388.41, -581.15, 132.3) setWeaponState(test, "ready") function rotate () local rotX, rotY, rotZ = getElementRotation(source) local x, y, z = getElementPosition(source) local rotX, rotY, rotZ = getElementRotation(test) setElementRotation(test, findRotation(x,y,rotX,rotY) ) end function bindTheKeys () bindKey ( "h", "down", rotate ) end addEventHandler("onClientResourceStart", getRootElement(), bindTheKeys)
-
Please help me:( this is the last think i need to finish my script
-
Its not working:// Its still looking to the right.. How can i make that? what function need i use? Anyway, im trying to make this script
-
Is it good? local weapon = createWeapon("m4", -2376.80, -578.50, 132.3) setWeaponState(weapon, "ready") Function bindFire () local rotX, rotY, rotZ = getElementRotation(weapon) local x, y, z = getElementPosition (weapon) local x, y, z = getElementPosition(source) local rotX, rotY, rotZ = getElementRotation(source) setElementRotation(weapon, findRotation(x,y,rotX,rotY) ); end addEvent( "bindFire", true ) addEventHandler( "bindFire", localPlayer, bindFire )
-
i dont really understand this function.. Can yoou make me an example pls?
-
Hi. Is it possible to use players camera to rotate an objects? I mean for example: if i move the player camera right then the object will rotate right too. is this possible? if yes what functions need i use? thanks.
-
Hi pls help me. I want to rotate the m4 weapon when i attach it to the player but when i try it then its not rotating the attached (weapon).. client local weapon = createWeapon("m4", -2376.80, -578.50, 132.3) setWeaponClipAmmo(weapon, 200) setWeaponState(weapon, "ready") function bindFire () local x, y, z = getElementPosition ( source ) local rotX, rotY, rotZ = getElementRotation(source) attachElements ( weapon, source, 0, 0.5, -0.46 ) setElementRotation(weapon,rotX,rotY,rotZ+45) <---- this is not working.. Its not rotating the weapon.. end addEvent( "bindFire", true ) addEventHandler( "bindFire", localPlayer, bindFire )