SA-MP Forums Archive
Tutorial - Question on how to make it - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Tutorial - Question on how to make it (/showthread.php?tid=335763)



Tutorial - Question on how to make it - Twisted_Insane - 19.04.2012

'Sup y'all?

I've got a question; what would I need to do if I want to script a command for a tutorial? I mean, whenever a player performed this command, he will see pictures from places of my gamemode and under them will be text (probably with textdraws). After 10 seconds for example, the picture would change to another one then. It'd be done with timers then. How to script such a command?


Re: Tutorial - Question on how to make it - Jonny5 - 19.04.2012

pictures from your gm?

what do you mean?

i guess you could put them in spectate and
setup the cam for the "pictures" you want to show,
and change the cam every 10 secs with a timer.


Re: Tutorial - Question on how to make it - Twisted_Insane - 19.04.2012

With 'pictures' I simply mean places from my gamemode, like the LS stadium. I'd need a little kick for starting it, so an example would be really appreciated!


Re: Tutorial - Question on how to make it - Twisted_Insane - 22.04.2012

Small bump.


Re: Tutorial - Question on how to make it - spedico - 22.04.2012

When player types the command, set the camera to look at a specific position (e.g. the stadium by using)

https://sampwiki.blast.hk/wiki/SetPlayerCameraLookAt
https://sampwiki.blast.hk/wiki/SetPlayerCameraPos

and then create a timer, that changes the cordinates after 10 minutes (and the text)


Re: Tutorial - Question on how to make it - Twisted_Insane - 22.04.2012

Quote:
Originally Posted by spedico
Посмотреть сообщение
When player types the command, set the camera to look at a specific position (e.g. the stadium by using)

https://sampwiki.blast.hk/wiki/SetPlayerCameraLookAt
https://sampwiki.blast.hk/wiki/SetPlayerCameraPos

and then create a timer, that changes the cordinates after 10 minutes (and the text)
That is the part I don't get; shall I create a new callback and kill the timer each time in it?


Re: Tutorial - Question on how to make it - spedico - 22.04.2012

I'd do it this way. I am not sure if it works or not, but it should. Feel free to adjust and try it.

pawn Код:
new CurrentStage[MAX_PLAYERS];
new PTT[MAX_PLAYERS]; // player tutorial timer
forward NextStage(playerid);

stock PlayerTutorial(playerid, stage)
{
    switch(stage)
    {
        case 0:
        {
            SetPlayerCameraLookAt(playerid, 0, 0, 0);
            SetPlayerCameraPos(playerid, 0, 0, 0);
            SendClientMessage(playerid, -1, "part 1: blabalablalbala");
            CurrentStage[playerid] = 0;
        }
        case 1:
        {
            SetPlayerCameraLookAt(playerid, 0, 0, 0);
            SetPlayerCameraPos(playerid, 0, 0, 0);
            SendClientMessage(playerid, -1, "part 2: blabalablalbala");
            CurrentStage[playerid] = 1;
        }
    }
}

stock RunTutorial(playerid)
{
    PlayerTutorial(playerid, 0);
    PTT[playerid] = SetTimerEx("NextStage", 10000, 1, "%d", playerid);
}

command(tutorial, playerid, params[])
{
    RunTutorial(playerid);
    return 1;
}

public NextStage(playerid)
{
    new Stage = CurrentStage[playerid] + 1;
    if(Stage >= 2) // if stage is 2 or over 2, kill the timer (there's just 2 stages in the example, starting from 0)
    {
        KillTimer(PTT[playerid]);
        SendClientMessage(playerid, -1, "you have finished the tutorial.");
    }
    else
    {
        PlayerTutorial(playerid, Stage);
    }
    return 1;
}



Re: Tutorial - Question on how to make it - 2KY - 22.04.2012

Just do something like;

pawn Код:
new TutStage [ MAX_PLAYERS ] = 0;

[INSIDE OF THE TIMER]

if( TutStage[playerid] == 0 )
{
//Start the tutorial...
TutStage[playerid]++;
}

else if(TutStage[playerid] == 1 )
{
//Next Stage..
TutStage[playerid]++;
}
You could also use a switch statement to make it faster.


Re: Tutorial - Question on how to make it - Faisal_khan - 22.04.2012

LetterBox mode will be good for you:
[FS] Letterbox Mode


Re: Tutorial - Question on how to make it - Twisted_Insane - 22.04.2012

Thank y'all guys, now I've got a little problem; the places look in the /tutorial too bad, all the textures are gone! Look at the picture. Did I do this right by setting both Camera functions to the same value?

PHP код:
stock PlayerTutorial(playeridstage)
{
    switch(
stage)
    {
        case 
0:
        {
            
SetPlayerCameraLookAt(playerid2442.1577,-1660.6066,27.4470);
            
SetPlayerCameraPos(playerid2442.1577,-1660.6066,27.4470);
            
SendClientMessage(playerid, -1"part 1: blabalablalbala");
            
CurrentStage[playerid] = 0;
        }
        case 
1:
        {
            
SetPlayerCameraLookAt(playerid2384.9014,-1667.0778,13.5469);
            
SetPlayerCameraPos(playerid2384.9014,-1667.0778,13.5469);
            
SendClientMessage(playerid, -1"part 2: blabalablalbala");
            
CurrentStage[playerid] = 1;
        }
    }

Second problem: The player can see the map and the chat. How to hide them in the tutorial except "TogglePlayerControllable" for the player?

By the way, thanks y'all, I gave y'all reputation!