Jump to content

About setCameraTarget


IloveMTA

Recommended Posts

Posted

Hello all,

It is said that I have to use timer with this to correctly place the camera at ped's back. But I use only this command with noting else, and it works fine by placing the camera back. Can someone tell why is it so? This bug fixed?

Thanks.

  • Moderators
Posted
show us ur code too

It's not necessary because he wanted to know why his code works because in the wiki it says that:

By default setCameraTarget will look at the player front, but if you want it to look from the back then you have to call the setCameraTarget twice, like this:
... 
    setCameraTarget(source) 
    setTimer(setCameraTarget, 100, 1, source) 
... 

Q: Why it's in a timer?

A: You have to put the second call in a timer, because the server will skip the second call if you won't delay it (he thinks that it's not necessary).

I don't know why and who said that but I think it's a noob:

I use this:

setCameraTarget( source, source ) 

It set the camera target of source at source ( so his camera on him )

Posted

Citizen thank you very much but it confused me more acutally.

CowTurbe code is like:

setCameraTarget(playerSource, getPlayerFromName("Blabla"))

When I use that to spec someone, I get the result I want (Sa-mp SetCameraBehindPlayer equiv., default camera from behind) It works fine. But what about timers? And when we need to use them? I want to make sure that I am not missing anything.

Thanks again.

Posted

Thanks solidsnake14, I want to spec someone.

setCameraTarget(playerSource, getPlayerFromName("Example"))

This works fine and I can spec the target person. However:

1. MTA wiki states that, setCameraTarget function places the camera "facing" the player, not from behind. And it says you should call this one more time with a timer to place it "behind" the player.

2. When I try this to spec someone, it places directly behind player without any timer or a second call of this func.

I need clearification on this. If this function works correctly, why is a timer or a second call needed? (for placing behind)Thank you

Posted

Hmmm, if you use this function once, when that player moves the camera stills following the target? if so, it doesn't need any timer i think.

Posted (edited)

Yes Snake, it follows. It should be removed from Wiki. Wiki is clearly wrong. I just switched from sa-mp but I am dissapointed because of many wiki mistakes. I hope they will get corrected soon.

Edited by Guest
  • Moderators
Posted

Yeah the guy who write that on the wiki is a noob ( and there are a bad syntax for the server-side )

Don't worry about this timer you don't need that :wink:

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...