SA-MP Forums Archive
tutorial scripting - 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 scripting (/showthread.php?tid=619208)



tutorial scripting - MrCesar - 15.10.2016

Hello guys, I want to script a tutorial, (rp style) for my server, what do i need to do it?
and is there any tutorial explaining what functions I need to use? thanks in advance


Re: tutorial scripting - Mencent - 15.10.2016

Hello.

How do you want to structure your tutorial? In a dialog or with a text in the chat?
Should the tutorial go on automatically with a timer or should the player press a button in the dialog to go on?


Re: tutorial scripting - MrCesar - 15.10.2016

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello.

How do you want to structure your tutorial? In a dialog or with a text in the chat?
Should the tutorial go on automatically with a timer or should the player press a button in the dialog to go on?
Hey, I want it with a timer, and in a text message, just setting the camera on some views, and making sendclientmessages, but how do i force spawn the player when the tutorial finishes etc?
thanks


Re: tutorial scripting - Mencent - 15.10.2016

OK.

You can do it like this:
PHP код:
//when the tutorial starts:
//1st message
SendClientMessage(playerid,-1,"here the text");
SetTimerEx("OnPlayerInTutorial",10000,0,"ii",playerid,1);
//the callback for the timer:
forward OnPlayerInTutorial(playerid,step);
public 
OnPlayerInTutorial(playerid,step)
{
    switch(
step)
    {
        case 
1:
        {
            
//2nd message
            
SendClientMessage(playerid,-1,"here the text");
            
SetTimerEx("OnPlayerInTutorial",10000,0,"ii",playerid,2);
            return 
1;
        }
        case 
2:
        {
            
//3rd message
            
SendClientMessage(playerid,-1,"here the text");
            
SetTimerEx("OnPlayerInTutorial",10000,0,"ii",playerid,3);
            return 
1;
        }
        case 
4:
        {
            
//4th message
            
SendClientMessage(playerid,-1,"here the text");
            
SetTimerEx("OnPlayerInTutorial",10000,0,"ii",playerid,5);
            return 
1;
        }
        case 
5:
        {
            
//last tutorial step
            
SendClientMessage(playerid,-1,"here the text");
            
SetTimerEx("OnPlayerInTutorial",10000,0,"ii",playerid,5);
            return 
1;
        }
        case 
6:
        {
            
SendClientMessage(playerid,-1,"You're tutorial is finish.");
            
SpawnPlayer(playerid);
            return 
1;
        }
    }
    return 
1;

You can take SetPlayerCameraPos (+SetPlayerCameraLookAt) or InterpolateCameraPos (+InterpolateCameraLookAt).

SetPlayerCameraPos + SetPlayerCameraLookAt => the camera is on a fix point and show to a fix point
InterpolateCameraPos + InterpolateCameraLookAt => the camera move (you can fix the seconds how long the camera should move)

More information you can get in sa-mp wiki.


Re: tutorial scripting - MrCesar - 15.10.2016

thanks alot!

EDIT: I am getting some kind of weird api-ms-win-crt-runtime error after i downloaded and included the streamer plugin, what's that?


Re: tutorial scripting - Sew_Sumi - 15.10.2016

Quote:
Originally Posted by MrCesar
Посмотреть сообщение
thanks alot!

EDIT: I am getting some kind of weird api-ms-win-crt-runtime error after i downloaded and included the streamer plugin, what's that?
You need the runtimes, in particular the 2015 ones are what the streamer needs.

https://sampforum.blast.hk/showthread.php?tid=606849


Re: tutorial scripting - MrCesar - 17.10.2016

Quote:
Originally Posted by Mencent
Посмотреть сообщение
OK.

You can do it like this:
PHP код:
//when the tutorial starts:
//1st message
SendClientMessage(playerid,-1,"here the text");
SetTimerEx("OnPlayerInTutorial",10000,0,"ii",playerid,1);
//the callback for the timer:
forward OnPlayerInTutorial(playerid,step);
public 
OnPlayerInTutorial(playerid,step)
{
    switch(
step)
    {
        case 
1:
        {
            
//2nd message
            
SendClientMessage(playerid,-1,"here the text");
            
SetTimerEx("OnPlayerInTutorial",10000,0,"ii",playerid,2);
            return 
1;
        }
        case 
2:
        {
            
//3rd message
            
SendClientMessage(playerid,-1,"here the text");
            
SetTimerEx("OnPlayerInTutorial",10000,0,"ii",playerid,3);
            return 
1;
        }
        case 
4:
        {
            
//4th message
            
SendClientMessage(playerid,-1,"here the text");
            
SetTimerEx("OnPlayerInTutorial",10000,0,"ii",playerid,5);
            return 
1;
        }
        case 
5:
        {
            
//last tutorial step
            
SendClientMessage(playerid,-1,"here the text");
            
SetTimerEx("OnPlayerInTutorial",10000,0,"ii",playerid,5);
            return 
1;
        }
        case 
6:
        {
            
SendClientMessage(playerid,-1,"You're tutorial is finish.");
            
SpawnPlayer(playerid);
            return 
1;
        }
    }
    return 
1;

You can take SetPlayerCameraPos (+SetPlayerCameraLookAt) or InterpolateCameraPos (+InterpolateCameraLookAt).

SetPlayerCameraPos + SetPlayerCameraLookAt => the camera is on a fix point and show to a fix point
InterpolateCameraPos + InterpolateCameraLookAt => the camera move (you can fix the seconds how long the camera should move)

More information you can get in sa-mp wiki.
hey sorry for bumping, but where do I insert the code?


Re: tutorial scripting - Gotham - 17.10.2016

On Player connect perhaps(check If he is not registered)