28.11.2010, 00:05
I'm making one of those Video tutorial on OnPlayerConnect and I want the camera to look at different places as the text appears, how do I use the timers to change the camera pos, and the camera look at ?
forward Tutorial();
SetTimer("Tutorial", 5000, true);
public Tutorial()
{
if(team(playerid) == 0)
{
SetPlayerCameraPos(playerid, 286.32, 1785.15, 63.57);
SetPlayerCameraLookAt(playerid, 203.95, 1902.99, 17.64);
}
return 1;
}
forward tutorial ( playerid );
SetTimerEx ( "tutorial", 5000, false, "d", playerid );

.public OnPlayerDeath(playerid)
forward changethistotimernamehere(playerid);
SetTimer("changethistotimernamehere",milliseconds, repeat or not);
forward Timerexample(playerid);
public OnPlayerDeath(playerid)
{
SetTimer("Timerexample", 2500, 0);
return 1;
}
public Timerexample(playerid)
{
//CODE HERE
return 1;
}
public Timerexample(playerid)
{
SetPlayerPos(playerid, coords);
return 1;
}
. forward Timerexample(playerid);
public OnPlayerDeath(playerid)
{
SetTimer("Timerexample", 2500, 0);
return 1;
}
public Timerexample(playerid)
{
SetPlayerPos(playerid, coords);
return 1;
}
!
.
|
Umm well lets make a simple timer
![]() First we need to find out what we want this timer to do, lets say we want it to send the player somewhere after they die .So we do this just above: Код:
public OnPlayerDeath(playerid) Код:
forward changethistotimernamehere(playerid); Код:
SetTimer("changethistotimernamehere",milliseconds, repeat or not);
After that lets make a new public for this timer, so underneath our current onplayerdeath code: Код:
forward Timerexample(playerid);
public OnPlayerDeath(playerid)
{
SetTimer("Timerexample", 2500, 0);
return 1;
}
Код:
public Timerexample(playerid)
{
//CODE HERE
return 1;
}
Код:
public Timerexample(playerid)
{
SetPlayerPos(playerid, coords);
return 1;
}
. All together it looks like this: Код:
forward Timerexample(playerid);
public OnPlayerDeath(playerid)
{
SetTimer("Timerexample", 2500, 0);
return 1;
}
public Timerexample(playerid)
{
SetPlayerPos(playerid, coords);
return 1;
}
! |