08.04.2012, 22:40
I want to make command when player type /tutorial then he needs to watch tutorial by SetPlayerCameraPos, I need only 3 positions showing, but I f**** something with timers...can you help giving me some script?
new pTutorial[MAX_PLAYERS]; // This is a global variable used to identify the player steps in tutorial
new pTutorialTimer[MAX_PLAYERS];
CMD:tutorial(playerid, params[])
{
if(pTutorial[playerid] > 0)
return SendClientMessage(playerid, -1, "You already started a tutorial.");
pTutorial[playerid] = 1;
//Here you set the first camera position coordinates and where to look at, etc etc
SendClientMessage(playerid, -1, "You started the tutorial.");
pTutorialTimer[playerid] = SetTimerEx("Tutorial", 10000, true, "i", playerid);
return 1;
}
forward Tutorial(playerid);
public Tutorial(playerid)
{
if(pTutorial[playerid] == 1)
{
pTutorial[playerid] ++;
//Here you set again the camera whereever you want.
SendClientMessage(playerid, -1, "The second step in your tutorial.");
}
else if(pTutorial[playerid] == 2)
{
pTutorial[playerid] ++;
//Here you set the third camera position and look at
SendClientMessage(playerid, -1, "The thirt step in your tutorial.");
}
else if(pTutorial[playerid] == 3)
{
pTutorial[playerid] ++;
//Here you can set the last camera position and look at
SendClientMessage(playerid, -1, "This is the final step in your tutorial. Congratulations.");
}
else KillTimer(pTutorialTimer[playerid]);
return 1;
}
public OnPlayerConnect(playerid)
{
pTutorial[playerid] = 0;
pTutorialTimer[playerid] = 0;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(pTutorialTimer[playerid]);
}
//here goes all previous tutorial positions
}
else if(pTutorial[playerid] == 5)
{
TogglePlayerControllable(playerid, 1);
OnPlayerSpawn(playerid);
}
else KillTimer(pTutorialTimer[playerid]);
return 1;
}
else if(pTutorial[playerid] == 5)
{
TogglePlayerControllable(playerid, 1);
SetCameraBehindPlayer(playerid);//setting cam behind player as normal
//Or you can do it OnPlayerSpawn(playerid) also
OnPlayerSpawn(playerid);
}
Try this :
pawn Код:
|