SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 24/08/2011, 08:00 AM   #1
lukas567
Big Clucker
 
Join Date: Jun 2011
Posts: 152
Reputation: 0
Default Timer problem

Hey guys!

I have a problem...

When I and my friend join to server, timers don't work... It have to Set other Camera Pos but don't work.
But when I join to server alone, it works...

Help me!!!

Code:
 	if(playerDB[playerid][newguy]==true)
	{
	TextDrawShowForPlayer(playerid, Text:Line1);
	TextDrawShowForPlayer(playerid, Text:Line2);
	SetTimer("lines", 15000, false);
	SetPlayerCameraPos(playerid,2047.1219,1008.4376,19.7687);
	SetPlayerCameraLookAt(playerid,2021.9423,1007.6476,15.2949);
	SetTimer("camera", 5000, false);
	SetPlayerSkin(playerid,248);
	playerDB[playerid][skin]=248;
	SetPlayerAttachedObject(playerid, 3, 1550, 1, 0.1, -0.3, 0, 0, 40, 0, 1, 1, 1);
		SetPlayerPos(playerid,1903.3308,965.7521,10.8203);
 	}
Code:
forward camera(playerid);
public camera(playerid)
{
SetPlayerCameraPos(playerid,1908.6547,963.1794,10.8203);
SetPlayerCameraLookAt(playerid,1903.4467,967.1631,10.8203);
SetTimer("camera2", 5000, false);
return 1;
}
forward lines(playerid);
public lines(playerid)
{
TextDrawHideForPlayer(playerid, Text:Line1);
TextDrawHideForPlayer(playerid, Text:Line2);
return 1;
}
forward camera2(playerid);
public camera2(playerid)
{
SetPlayerCameraPos(playerid,1888.9412,946.0771,15.0975);
SetPlayerCameraLookAt(playerid,1883.4490,977.2070,10.8203);
SetTimer("camerab", 5000, false);
return 1;
}
forward camerab(playerid);
public camerab(playerid)
{
SetCameraBehindPlayer(playerid);
return 1;
}
lukas567 is offline  
Old 24/08/2011, 08:03 AM   #2
[HiC]TheKiller
High-roller
 
Join Date: Mar 2008
Location: New Zealand
Posts: 3,038
Reputation: 407
Default Re: Timer problem

This must be one of the most common issues with new scripters. You need to actually send the playerid param for the function to actually process it.

For this, we are going to use http://wiki.sa-mp.com/wiki/SetTimerEx

Code:
SetTimerEx("camera", 5000, false, "d", playerid);

Do the same thing for all of your other timers.
__________________
[HiC]TheKiller is offline  
Old 24/08/2011, 08:33 AM   #3
lukas567
Big Clucker
 
Join Date: Jun 2011
Posts: 152
Reputation: 0
Default Re: Timer problem

Thanks, but i think there is problem because i didn't put [MAX_PLAYERS] to work for all players, but i dont know where to put it.
Please help!
lukas567 is offline  
Old 24/08/2011, 08:43 AM   #4
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,046
Reputation: 130
Default Re: Timer problem

Example:
Code:
new Timer[MAX_PLAYERS];

Timer[playerid] = SetTimerEx(.............)
__________________
(RETIRED)
=WoR=Varth is offline  
Old 24/08/2011, 08:59 AM   #5
lukas567
Big Clucker
 
Join Date: Jun 2011
Posts: 152
Reputation: 0
Default Re: Timer problem

But this will work just with SetTimerEx?
lukas567 is offline  
Old 24/08/2011, 09:02 AM   #6
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,046
Reputation: 130
Default Re: Timer problem

You can set anything to variable. http://wiki.sa-mp.com/wiki/Scripting_Basics#Variables
If you need to pass a value, you have to use SetTimerEx.
__________________
(RETIRED)
=WoR=Varth is offline  
 

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer Problem.. GrandMaa Help Archive 0 10/05/2011 09:06 PM
A Problem About Timer VivianKris Help Archive 2 24/04/2011 03:05 PM
Timer problem Bilawal2050 Help Archive 2 19/03/2011 02:22 PM
Timer Problem. GaB1TzZzu Help Archive 12 14/01/2011 11:29 AM
Timer does problem again deather Help Archive 0 27/01/2010 12:55 PM


All times are GMT. The time now is 04:30 PM.


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