SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 27/09/2019, 05:35 PM   #1
NoteND
Huge Clucker
 
Join Date: May 2016
Posts: 214
Reputation: 3
Default What is better to use?

Hey!

I'm just wondering something about this script right here

Code:
public OnPlayerConnect(playerid)
{
      TogglePlayerSpectating(playerid, true);
      SetTimerEx("Cinematic", 100, 0, "d", playerid);
}
Do I need a timer after "TogglePlayerSpectating" at all because sometimes it bugs and doesnt make the player go to cinematic which is InterpolateCameraPos.. and is it okay if I just use SetTimerEx without player variable before it? like..

Code:
PlayerTimer[playerid] = SetTimerEx("Cinematic", 100, 0, "d", playerid);
Thanks for help in advance.
NoteND is offline   Reply With Quote
Old 27/09/2019, 05:46 PM   #2
Jonny
Huge Clucker
 
Jonny's Avatar
 
Join Date: Nov 2009
Location: Italy
Posts: 281
Reputation: 38
Default Re: What is better to use?

If you don't need to kill the timer before the interval then you don't need a variable.
Also, i'm aware that sometimes the InterpolateCamera gets bugged but i don't really know if giving it an interval would fix the problem, i always thought that was a sa-mp bug
__________________
Jonny is offline   Reply With Quote
Old 27/09/2019, 06:53 PM   #3
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,230
Reputation: 993
Default Re: What is better to use?

Sometimes 100ms may not be long enough. You should wait for a couple of OnPlayerUpdate calls.

I would recommend using my camera include here https://forum.sa-mp.com/showthread.php?t=412767 as everything is done for you. Or you could view the code to see what I mean about OPU.
__________________
Click banner above for more info. View trailers here.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 27/09/2019, 07:32 PM   #4
NoteND
Huge Clucker
 
Join Date: May 2016
Posts: 214
Reputation: 3
Default Re: What is better to use?

Quote:
Originally Posted by MP2 View Post
Sometimes 100ms may not be long enough. You should wait for a couple of OnPlayerUpdate calls.

I would recommend using my camera include here https://forum.sa-mp.com/showthread.php?t=412767 as everything is done for you. Or you could view the code to see what I mean about OPU.

Okay thank you very much, will try it out.
NoteND is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 05:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.