Tutorial for new players
#1

Hi,
I made a tutorial for new players who come in my server, to explain them how it works. But if other people talk, they won't have the time to read the explanations. So my idea was to make a timer (1 second) which will re-send the same message, again and again, till the player want to see the next page of the tutorial or till the tutorial ends.
Another thing i noticed, if the player start the tutorial in an interior. When the tutorial will end, he will be at his positions like before he launched the tutorial but will appear bugged cause he is in interior 0. And i don't know how to save the interior of a player as a variable, like that i can add : SetPlayerInterior(playerid, interior);

How can I make/fix it ? Thanks !

Код:
new TUTORIAL[MAX_PLAYER_NAME];
new Float: x, Float: y, Float: z;

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/tutoriel", cmdtext, true, 9) == 0)
  {
		GetPlayerPos(playerid, x, y, z);
		
    if (TUTORIAL[playerid] == 0)
    {
    TogglePlayerControllable(playerid, 0);
    SendClientMessage(playerid, 0xfd0000ff, "TEXT 1");
    TUTORIAL[playerid] = 1;
		return 1;
		}
	}
	else if (strcmp("/next", cmdtext, true, 5) == 0)
	{
		if (TUTORIAL[playerid] == 1)
		{
		SendClientMessage(playerid, 0xfd0000ff, "TEXT 2");
		TUTORIAL[playerid] = 2;
		return 1;
		}
		else if (TUTORIAL[playerid] == 2)
		{
		SendClientMessage(playerid, 0xfd0000ff, "TEXT 3");
		TUTORIAL[playerid] = 3;
		return 1;
		}
		else if (TUTORIAL[playerid] == 3)
		{
		SetPlayerCameraPos(playerid, 1722.9542,-1560.2708,70.0261);
		SetPlayerCameraLookAt(playerid, 1727.0585,-1637.0344,20.2174);
             SetPlayerPos(playerid, 1722.9542,-1560.2708,0);
             SetPlayerInterior(playerid, 0);
		SendClientMessage(playerid, 0xfd0000, "TEXT 4");
		TUTORIAL[playerid] = 4;
		return 1;
		}
		else if (TUTORIAL[playerid] == 4)
		{
		SetPlayerPos(playerid, x, y, z);
		SetCameraBehindPlayer(playerid);
		TogglePlayerControllable(playerid, 1);
		SendClientMessage(playerid, 0xfd0000, "END OF THE TUTORIAL");
		TUTORIAL[playerid] = 0;
		return 1;
		}
	}
	else if (strcmp("/stop", cmdtext, true, 5) == 0)
	{
		if (TUTORIAL[playerid] == 1 || TUTORIAL[playerid] == 2 || TUTORIAL[playerid] == 3 || TUTORIAL[playerid] == 4)
		{
		SendClientMessage(playerid, 0xfd0000ff, "END OF THE TUTORIAL");
		TUTORIAL[playerid] = 0;
		SetPlayerPos(playerid, x, y, z);
		SetCameraBehindPlayer(playerid);
		TogglePlayerControllable(playerid, 1);
		return 1;
		}
	}
	return 0;
}
Reply
#2

You could use textdraws for the tutorial instead of ClientMessages, so the player's chatting won't make the tutorial text go up.

about the interior,
pawn Код:
new somevar[MAX_PLAYERS];
// [...]
somevar[playerid] = GetPlayerInterior(playerid);
But, the interior bug is because the x, y, and z Float values can't store the position of each player, you need to define them as an array, so
pawn Код:
new
  Float:x[MAX_PLAYERS],
  Float:y[MAX_PLAYERS],
  Float:z[MAX_PLAYERS];
// [...]
GetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]);


// but this is even better to do:
new Float:PlayerPosData[MAX_PLAYERS][3];
// [...]
GetPlayerPos(playerid, PlayerPosData[playerid][0], PlayerPosData[playerid][1], PlayerPosData[playerid][2]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)