Yurigarga Posted July 12, 2018 Share Posted July 12, 2018 What should I do ? function DrawLaser(player) if getElementData(player, "laser.on") then local targetself = getPedTarget(player) if targetself and targetself == player then targetself = true else targetself = false end if getElementData(player, "laser.aim") and IsPlayerWeaponValidForLaser(player) == true and targetself == false then local x,y,z = getPedWeaponMuzzlePosition(player) if not x then outputDebugString("getPedWeaponMuzzlePosition failed") x,y,z = getPedTargetStart(player) end local x2,y2,z2 = getPedTargetEnd(player) if not x2 then --outputDebugString("getPedTargetEnd failed") return end local x3,y3,z3 = getPedTargetCollision(player) local r,g,b,a = GetLaserColor(player) if x3 then -- collision detected, draw til collision and add a dot dxDrawLine3D(x,y,z,x3,y3,z3, tocolor(r,g,b,a), laserWidth) DrawLaserDot(player, x3,y3,z3) else dxDrawLine3D(x,y,z,x2,y2,z2, tocolor(r,g,b,a), laserWidth) ----641.dize DestroyLaserDot(player) end else DestroyLaserDot(player) end else DestroyLaserDot(player) end end Link to comment
Galactix Posted July 12, 2018 Share Posted July 12, 2018 I think the error is because you're using player both in your targetself variable and if statement. Try to change the if part to Something like if targetself == source. If you just use player like you did then it will do it for ALL the players targeted and it will Always hide the laser. 1 Link to comment
Yurigarga Posted July 12, 2018 Author Share Posted July 12, 2018 10 minutes ago, Galactix said: Hatanın nedeni, oyuncuyu hem hedef kendiniz değişkeninde hem de ifadede kullanıyor olmanızdır. Eğer, eğer targetself == source gibi birşeyi değiştirmeyi deneyin. Eğer sadece senin gibi bir oyuncu kullanırsan, o zaman bunu TÜM oyuncular için yapacaktır ve daima lazeri gizleyecektir. I did not understand.Do you want to add code Link to comment
Galactix Posted July 12, 2018 Share Posted July 12, 2018 function DrawLaser(player) if getElementData(player, "laser.on") then local targetself = getPedTarget(player) if targetself and targetself == source then targetself = true else targetself = false end if getElementData(player, "laser.aim") and IsPlayerWeaponValidForLaser(player) == true and targetself == false then local x,y,z = getPedWeaponMuzzlePosition(player) if not x then outputDebugString("getPedWeaponMuzzlePosition failed") x,y,z = getPedTargetStart(player) end local x2,y2,z2 = getPedTargetEnd(player) if not x2 then --outputDebugString("getPedTargetEnd failed") return end local x3,y3,z3 = getPedTargetCollision(player) local r,g,b,a = GetLaserColor(player) if x3 then -- collision detected, draw til collision and add a dot dxDrawLine3D(x,y,z,x3,y3,z3, tocolor(r,g,b,a), laserWidth) DrawLaserDot(player, x3,y3,z3) else dxDrawLine3D(x,y,z,x2,y2,z2, tocolor(r,g,b,a), laserWidth) ----641.dize DestroyLaserDot(player) end else DestroyLaserDot(player) end else DestroyLaserDot(player) end 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now