A little help with InterpolateCameraPos and toggleplayerspectating
#1

Hi all! I am using InterpolateCameraPos and toggleplayerspectating at request class and i want it to get back to request class when it ends can anyone tell me, I have tried to set toggle player spectating to off but it spawns the player without selecting the class server closes the connection. Help!!!
Reply
#2

Can you please show us your current code in OnPlayerConnect and OnPlayerSpawn? (Assuming these are the two locations it enables/disables it).
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=465737 I am using this and want to return to request class when it ends.
pawn Код:
// By adri1.

#include <a_samp>
main();
new Text:roleplaybox;
new PlayerText:roleplay[MAX_PLAYERS];
forward OnPlayerFinishInterpolateCamera(playerid, type);

public OnFilterScriptInit()
{
    SetGameModeText("Test");
    roleplaybox = TextDrawCreate(205.212234, 372.750000, "-");
    TextDrawLetterSize(roleplaybox, 15.362092, 1.419166);
    TextDrawAlignment(roleplaybox, 1);
    TextDrawColor(roleplaybox, -1);
    TextDrawSetShadow(roleplaybox, 0);
    TextDrawSetOutline(roleplaybox, 2);
    TextDrawBackgroundColor(roleplaybox, 51);
    TextDrawFont(roleplaybox, 1);
    TextDrawSetProportional(roleplaybox, 1);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
        TogglePlayerSpectating(playerid, 1);
        SetPlayerPos(playerid, 155.3337, -1776.4384, 14.8978+5.0);
        TogglePlayerControllable(playerid, false);
        PlayAudioStreamForPlayer(playerid, "https://dl.dropboxusercontent.com/s/z834k2bgngbcmm6/kbgdHubwVdkG.128.mp3");
        SetPlayerCameraPos(playerid, 155.3337, -1776.4384, 14.8978);
        SetPlayerCameraLookAt(playerid, 156.2734, -1776.0850, 14.2128);
        InterpolateCameraLookAt(playerid, 156.2734, -1776.0850, 14.2128, 156.2713, -1776.0797, 14.7078, 5000, CAMERA_MOVE);
        SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 0);
        PlayerTextDrawShow(playerid, roleplay[playerid]);
        for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        return 1;
}

public OnPlayerConnect(playerid)
{
    roleplay[playerid] = CreatePlayerTextDraw(playerid, 317.188934, 349.999725, "e");
    PlayerTextDrawLetterSize(playerid, roleplay[playerid], 0.586340, 3.052500);
    PlayerTextDrawAlignment(playerid, roleplay[playerid], 2);
    PlayerTextDrawColor(playerid, roleplay[playerid], -1);
    PlayerTextDrawSetShadow(playerid, roleplay[playerid], -258);
    PlayerTextDrawSetOutline(playerid, roleplay[playerid], 0);
    PlayerTextDrawBackgroundColor(playerid, roleplay[playerid], -2139062017);
    PlayerTextDrawFont(playerid, roleplay[playerid], 1);
    PlayerTextDrawSetProportional(playerid, roleplay[playerid], 1);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerFinishInterpolateCamera(playerid, type)
{
    switch(type)
    {
        case 0:
        {
            InterpolateCameraPos(playerid, 187.600982, -1791.727050, 119.087432, 193.731567, -1789.235473, 118.845245, 5000);
            InterpolateCameraLookAt(playerid, 189.006942, -1790.279785, 114.512641, 195.057144, -1788.512817, 114.078620, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 1);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eX");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 1:
        {
            InterpolateCameraPos(playerid, 300.803771, -1753.841796, 59.482250, 332.887237, -1753.466674, 60.534908, 4000);
            InterpolateCameraLookAt(playerid, 302.467315, -1749.504394, 57.633026, 334.005126, -1748.907470, 58.813385, 4000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 4000-600, 0, "id", playerid, 2);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXt");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 2:
        {
            InterpolateCameraPos(playerid, 350.840972, -1794.716308, 13.146982, 346.193756, -1800.415649, 10.697548, 8000);
            InterpolateCameraLookAt(playerid, 348.053558, -1790.653564, 12.295993, 342.141357, -1797.657592, 9.712170, 8000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 8000-600, 0, "id", playerid, 3);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtr");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 3:
        {
            InterpolateCameraPos(playerid, 169.602859, -1775.647705, 6.933395, 169.617141, -1776.156250, 12.790164, 5000);
            InterpolateCameraLookAt(playerid, 169.547332, -1770.651367, 7.117267, 169.588928, -1771.159301, 12.618641, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 4);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtre");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 4:
        {
            InterpolateCameraPos(playerid, 386.273284, -2030.129516, 59.993469, 395.822113, -2044.595703, 59.993469, 5000);
            InterpolateCameraLookAt(playerid, 386.591949, -2029.832275, 55.012496, 396.252319, -2044.526245, 55.012496, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 5);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtrem");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 5:
        {
            InterpolateCameraPos(playerid, 341.018402, -2095.904052, 6.937077, 342.805603, -2096.498535, 6.648118, 5000);
            InterpolateCameraLookAt(playerid, 345.258972, -2093.501220, 5.821543, 347.304443, -2094.563964, 5.639461, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 6);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 6:
        {
            InterpolateCameraPos(playerid, 481.641052, -1804.006835, 6.803627, 484.250549, -1802.375244, 6.660738, 5000);
            InterpolateCameraLookAt(playerid, 485.734344, -1801.318481, 5.794973, 488.679290, -1800.236572, 5.759444, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 7);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme R");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 7:
        {
            InterpolateCameraPos(playerid, 662.689147, -1868.981201, 6.513285, 665.048583, -1870.174438, 6.864079, 5000);
            InterpolateCameraLookAt(playerid, 658.142028, -1867.027709, 5.800874, 661.006286, -1867.294311, 6.260089, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 8);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Ro");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 8:
        {
            InterpolateCameraPos(playerid, 542.343933, -1901.457519, 2.008791, 544.523376, -1901.883666, 2.085470, 5000);
            InterpolateCameraLookAt(playerid, 544.995666, -1897.256958, 2.577868, 546.892395, -1897.521118, 2.681705, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 9);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Rol");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 9:
        {
            InterpolateCameraPos(playerid, 542.945800, -1863.699707, 4.435829, 539.996215, -1863.695556, 4.304386, 5000);
            InterpolateCameraLookAt(playerid, 537.950744, -1863.694213, 4.213245, 535.009887, -1863.990478, 4.081802, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 10);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 10:
        {
            InterpolateCameraPos(playerid, 329.131469, -1791.461791, 15.695193, 326.005981, -1793.169311, 15.695193, 3000);
            InterpolateCameraLookAt(playerid, 326.451660, -1787.321044, 14.874702, 323.228546, -1789.171630, 14.553024, 3000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 3000-600, 0, "id", playerid, 11);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role P");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 11:
        {
            InterpolateCameraPos(playerid, 514.983886, -1760.605102, 17.303379, 514.898010, -1760.553955, 18.443613, 3000);
            InterpolateCameraLookAt(playerid, 519.002807, -1762.556640, 15.058471, 519.071899, -1762.496826, 16.493217, 3000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 3000-600, 0, "id", playerid, 12);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role Pl");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 12:
        {
            InterpolateCameraPos(playerid, 524.473022, -1763.555786, 14.948656, 524.520751, -1763.556152, 15.495350, 5000);
            InterpolateCameraLookAt(playerid, 519.486999, -1763.304687, 14.671454, 519.540893, -1763.958007, 15.296504, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 13);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role Pla");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 13:
        {
            InterpolateCameraPos(playerid, 545.416076, -1772.326171, 8.179362, 547.233886, -1774.291870, 8.147984, 5000);
            InterpolateCameraLookAt(playerid, 548.811035, -1775.996459, 8.120770, 550.628845, -1777.962158, 8.089392, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 14);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role Play");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 14:
        {
            InterpolateCameraPos(playerid, 550.013793, -1772.057128, 16.024028, 552.169799, -1772.079223, 16.285087, 5000);
            InterpolateCameraLookAt(playerid, 546.803894, -1768.331054, 15.122734, 548.959899, -1768.353149, 15.383792, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 15);
            TextDrawShowForPlayer(playerid, roleplaybox);
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
    }
}
EDIT: I changed it a little bit so it starts intro at request class
Reply
#4

EDIT: nevermind, I am just tired, let me look over it again.
Reply
#5

Know what! I got it.

Using this:
ForceClassSelection(playerid);
TogglePlayerSpectating(playerid, true);
TogglePlayerSpectating(playerid, false);

And:

new HasSeenIntro[MAX_PLAYERS];

To prevent the player in rotating in intro. Sorry for wasting everyone's time.

EDIT: Can improve the code and post here!

pawn Код:
// By adri1.

#include <a_samp>
main();
new HasSeenIntro[MAX_PLAYERS];
new Text:roleplaybox;
new PlayerText:roleplay[MAX_PLAYERS];
forward OnPlayerFinishInterpolateCamera(playerid, type);

public OnFilterScriptInit()
{
    SetGameModeText("Test");
    roleplaybox = TextDrawCreate(205.212234, 372.750000, "-");
    TextDrawLetterSize(roleplaybox, 15.362092, 1.419166);
    TextDrawAlignment(roleplaybox, 1);
    TextDrawColor(roleplaybox, -1);
    TextDrawSetShadow(roleplaybox, 0);
    TextDrawSetOutline(roleplaybox, 2);
    TextDrawBackgroundColor(roleplaybox, 51);
    TextDrawFont(roleplaybox, 1);
    TextDrawSetProportional(roleplaybox, 1);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    if(HasSeenIntro[playerid] == 1) return 1;
    if(HasSeenIntro[playerid] == 0)
    {
        TogglePlayerSpectating(playerid, 1);
        SetPlayerPos(playerid, 155.3337, -1776.4384, 14.8978+5.0);
        TogglePlayerControllable(playerid, false);
        PlayAudioStreamForPlayer(playerid, "https://dl.dropboxusercontent.com/s/z834k2bgngbcmm6/kbgdHubwVdkG.128.mp3");
        SetPlayerCameraPos(playerid, 155.3337, -1776.4384, 14.8978);
        SetPlayerCameraLookAt(playerid, 156.2734, -1776.0850, 14.2128);
        InterpolateCameraLookAt(playerid, 156.2734, -1776.0850, 14.2128, 156.2713, -1776.0797, 14.7078, 5000, CAMERA_MOVE);
        SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 0);
        PlayerTextDrawShow(playerid, roleplay[playerid]);
        for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    roleplay[playerid] = CreatePlayerTextDraw(playerid, 317.188934, 349.999725, "e");
    PlayerTextDrawLetterSize(playerid, roleplay[playerid], 0.586340, 3.052500);
    PlayerTextDrawAlignment(playerid, roleplay[playerid], 2);
    PlayerTextDrawColor(playerid, roleplay[playerid], -1);
    PlayerTextDrawSetShadow(playerid, roleplay[playerid], -258);
    PlayerTextDrawSetOutline(playerid, roleplay[playerid], 0);
    PlayerTextDrawBackgroundColor(playerid, roleplay[playerid], -2139062017);
    PlayerTextDrawFont(playerid, roleplay[playerid], 1);
    PlayerTextDrawSetProportional(playerid, roleplay[playerid], 1);
    HasSeenIntro[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerFinishInterpolateCamera(playerid, type)
{
    switch(type)
    {
        case 0:
        {
            InterpolateCameraPos(playerid, 187.600982, -1791.727050, 119.087432, 193.731567, -1789.235473, 118.845245, 5000);
            InterpolateCameraLookAt(playerid, 189.006942, -1790.279785, 114.512641, 195.057144, -1788.512817, 114.078620, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 1);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eX");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 1:
        {
            InterpolateCameraPos(playerid, 300.803771, -1753.841796, 59.482250, 332.887237, -1753.466674, 60.534908, 4000);
            InterpolateCameraLookAt(playerid, 302.467315, -1749.504394, 57.633026, 334.005126, -1748.907470, 58.813385, 4000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 4000-600, 0, "id", playerid, 2);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXt");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 2:
        {
            InterpolateCameraPos(playerid, 350.840972, -1794.716308, 13.146982, 346.193756, -1800.415649, 10.697548, 8000);
            InterpolateCameraLookAt(playerid, 348.053558, -1790.653564, 12.295993, 342.141357, -1797.657592, 9.712170, 8000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 8000-600, 0, "id", playerid, 3);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtr");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 3:
        {
            InterpolateCameraPos(playerid, 169.602859, -1775.647705, 6.933395, 169.617141, -1776.156250, 12.790164, 5000);
            InterpolateCameraLookAt(playerid, 169.547332, -1770.651367, 7.117267, 169.588928, -1771.159301, 12.618641, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 4);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtre");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 4:
        {
            InterpolateCameraPos(playerid, 386.273284, -2030.129516, 59.993469, 395.822113, -2044.595703, 59.993469, 5000);
            InterpolateCameraLookAt(playerid, 386.591949, -2029.832275, 55.012496, 396.252319, -2044.526245, 55.012496, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 5);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtrem");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 5:
        {
            InterpolateCameraPos(playerid, 341.018402, -2095.904052, 6.937077, 342.805603, -2096.498535, 6.648118, 5000);
            InterpolateCameraLookAt(playerid, 345.258972, -2093.501220, 5.821543, 347.304443, -2094.563964, 5.639461, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 6);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 6:
        {
            InterpolateCameraPos(playerid, 481.641052, -1804.006835, 6.803627, 484.250549, -1802.375244, 6.660738, 5000);
            InterpolateCameraLookAt(playerid, 485.734344, -1801.318481, 5.794973, 488.679290, -1800.236572, 5.759444, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 7);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme R");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 7:
        {
            InterpolateCameraPos(playerid, 662.689147, -1868.981201, 6.513285, 665.048583, -1870.174438, 6.864079, 5000);
            InterpolateCameraLookAt(playerid, 658.142028, -1867.027709, 5.800874, 661.006286, -1867.294311, 6.260089, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 8);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Ro");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 8:
        {
            InterpolateCameraPos(playerid, 542.343933, -1901.457519, 2.008791, 544.523376, -1901.883666, 2.085470, 5000);
            InterpolateCameraLookAt(playerid, 544.995666, -1897.256958, 2.577868, 546.892395, -1897.521118, 2.681705, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 9);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Rol");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 9:
        {
            InterpolateCameraPos(playerid, 542.945800, -1863.699707, 4.435829, 539.996215, -1863.695556, 4.304386, 5000);
            InterpolateCameraLookAt(playerid, 537.950744, -1863.694213, 4.213245, 535.009887, -1863.990478, 4.081802, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 10);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 10:
        {
            InterpolateCameraPos(playerid, 329.131469, -1791.461791, 15.695193, 326.005981, -1793.169311, 15.695193, 3000);
            InterpolateCameraLookAt(playerid, 326.451660, -1787.321044, 14.874702, 323.228546, -1789.171630, 14.553024, 3000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 3000-600, 0, "id", playerid, 11);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role P");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 11:
        {
            InterpolateCameraPos(playerid, 514.983886, -1760.605102, 17.303379, 514.898010, -1760.553955, 18.443613, 3000);
            InterpolateCameraLookAt(playerid, 519.002807, -1762.556640, 15.058471, 519.071899, -1762.496826, 16.493217, 3000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 3000-600, 0, "id", playerid, 12);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role Pl");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 12:
        {
            InterpolateCameraPos(playerid, 524.473022, -1763.555786, 14.948656, 524.520751, -1763.556152, 15.495350, 5000);
            InterpolateCameraLookAt(playerid, 519.486999, -1763.304687, 14.671454, 519.540893, -1763.958007, 15.296504, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 13);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role Pla");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 13:
        {
            InterpolateCameraPos(playerid, 545.416076, -1772.326171, 8.179362, 547.233886, -1774.291870, 8.147984, 5000);
            InterpolateCameraLookAt(playerid, 548.811035, -1775.996459, 8.120770, 550.628845, -1777.962158, 8.089392, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 14);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role Play");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 14:
        {
            InterpolateCameraPos(playerid, 550.013793, -1772.057128, 16.024028, 552.169799, -1772.079223, 16.285087, 5000);
            InterpolateCameraLookAt(playerid, 546.803894, -1768.331054, 15.122734, 548.959899, -1768.353149, 15.383792, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 15);
            TextDrawShowForPlayer(playerid, roleplaybox);
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
            HasSeenIntro[playerid] = 1;
            ForceClassSelection(playerid);
            TogglePlayerSpectating(playerid, true);
            TogglePlayerSpectating(playerid, false);
        }
    }
}
Reply
#6

Quote:
Originally Posted by HitterHitman
Посмотреть сообщение
Know what! I got it.

Using this:
ForceClassSelection(playerid);
TogglePlayerSpectating(playerid, true);
TogglePlayerSpectating(playerid, false);

And:

new HasSeenIntro[MAX_PLAYERS];

To prevent the player in rotating in intro. Sorry for wasting everyone's time.

EDIT: Can improve the code and post here!

pawn Код:
// By adri1.

#include <a_samp>
main();
new HasSeenIntro[MAX_PLAYERS];
new Text:roleplaybox;
new PlayerText:roleplay[MAX_PLAYERS];
forward OnPlayerFinishInterpolateCamera(playerid, type);

public OnFilterScriptInit()
{
    SetGameModeText("Test");
    roleplaybox = TextDrawCreate(205.212234, 372.750000, "-");
    TextDrawLetterSize(roleplaybox, 15.362092, 1.419166);
    TextDrawAlignment(roleplaybox, 1);
    TextDrawColor(roleplaybox, -1);
    TextDrawSetShadow(roleplaybox, 0);
    TextDrawSetOutline(roleplaybox, 2);
    TextDrawBackgroundColor(roleplaybox, 51);
    TextDrawFont(roleplaybox, 1);
    TextDrawSetProportional(roleplaybox, 1);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    if(HasSeenIntro[playerid] == 1) return 1;
    if(HasSeenIntro[playerid] == 0)
    {
        TogglePlayerSpectating(playerid, 1);
        SetPlayerPos(playerid, 155.3337, -1776.4384, 14.8978+5.0);
        TogglePlayerControllable(playerid, false);
        PlayAudioStreamForPlayer(playerid, "https://dl.dropboxusercontent.com/s/z834k2bgngbcmm6/kbgdHubwVdkG.128.mp3");
        SetPlayerCameraPos(playerid, 155.3337, -1776.4384, 14.8978);
        SetPlayerCameraLookAt(playerid, 156.2734, -1776.0850, 14.2128);
        InterpolateCameraLookAt(playerid, 156.2734, -1776.0850, 14.2128, 156.2713, -1776.0797, 14.7078, 5000, CAMERA_MOVE);
        SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 0);
        PlayerTextDrawShow(playerid, roleplay[playerid]);
        for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    roleplay[playerid] = CreatePlayerTextDraw(playerid, 317.188934, 349.999725, "e");
    PlayerTextDrawLetterSize(playerid, roleplay[playerid], 0.586340, 3.052500);
    PlayerTextDrawAlignment(playerid, roleplay[playerid], 2);
    PlayerTextDrawColor(playerid, roleplay[playerid], -1);
    PlayerTextDrawSetShadow(playerid, roleplay[playerid], -258);
    PlayerTextDrawSetOutline(playerid, roleplay[playerid], 0);
    PlayerTextDrawBackgroundColor(playerid, roleplay[playerid], -2139062017);
    PlayerTextDrawFont(playerid, roleplay[playerid], 1);
    PlayerTextDrawSetProportional(playerid, roleplay[playerid], 1);
    HasSeenIntro[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerFinishInterpolateCamera(playerid, type)
{
    switch(type)
    {
        case 0:
        {
            InterpolateCameraPos(playerid, 187.600982, -1791.727050, 119.087432, 193.731567, -1789.235473, 118.845245, 5000);
            InterpolateCameraLookAt(playerid, 189.006942, -1790.279785, 114.512641, 195.057144, -1788.512817, 114.078620, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 1);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eX");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 1:
        {
            InterpolateCameraPos(playerid, 300.803771, -1753.841796, 59.482250, 332.887237, -1753.466674, 60.534908, 4000);
            InterpolateCameraLookAt(playerid, 302.467315, -1749.504394, 57.633026, 334.005126, -1748.907470, 58.813385, 4000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 4000-600, 0, "id", playerid, 2);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXt");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 2:
        {
            InterpolateCameraPos(playerid, 350.840972, -1794.716308, 13.146982, 346.193756, -1800.415649, 10.697548, 8000);
            InterpolateCameraLookAt(playerid, 348.053558, -1790.653564, 12.295993, 342.141357, -1797.657592, 9.712170, 8000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 8000-600, 0, "id", playerid, 3);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtr");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 3:
        {
            InterpolateCameraPos(playerid, 169.602859, -1775.647705, 6.933395, 169.617141, -1776.156250, 12.790164, 5000);
            InterpolateCameraLookAt(playerid, 169.547332, -1770.651367, 7.117267, 169.588928, -1771.159301, 12.618641, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 4);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtre");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 4:
        {
            InterpolateCameraPos(playerid, 386.273284, -2030.129516, 59.993469, 395.822113, -2044.595703, 59.993469, 5000);
            InterpolateCameraLookAt(playerid, 386.591949, -2029.832275, 55.012496, 396.252319, -2044.526245, 55.012496, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 5);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtrem");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 5:
        {
            InterpolateCameraPos(playerid, 341.018402, -2095.904052, 6.937077, 342.805603, -2096.498535, 6.648118, 5000);
            InterpolateCameraLookAt(playerid, 345.258972, -2093.501220, 5.821543, 347.304443, -2094.563964, 5.639461, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 6);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 6:
        {
            InterpolateCameraPos(playerid, 481.641052, -1804.006835, 6.803627, 484.250549, -1802.375244, 6.660738, 5000);
            InterpolateCameraLookAt(playerid, 485.734344, -1801.318481, 5.794973, 488.679290, -1800.236572, 5.759444, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 7);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme R");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 7:
        {
            InterpolateCameraPos(playerid, 662.689147, -1868.981201, 6.513285, 665.048583, -1870.174438, 6.864079, 5000);
            InterpolateCameraLookAt(playerid, 658.142028, -1867.027709, 5.800874, 661.006286, -1867.294311, 6.260089, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 8);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Ro");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 8:
        {
            InterpolateCameraPos(playerid, 542.343933, -1901.457519, 2.008791, 544.523376, -1901.883666, 2.085470, 5000);
            InterpolateCameraLookAt(playerid, 544.995666, -1897.256958, 2.577868, 546.892395, -1897.521118, 2.681705, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 9);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Rol");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 9:
        {
            InterpolateCameraPos(playerid, 542.945800, -1863.699707, 4.435829, 539.996215, -1863.695556, 4.304386, 5000);
            InterpolateCameraLookAt(playerid, 537.950744, -1863.694213, 4.213245, 535.009887, -1863.990478, 4.081802, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 10);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 10:
        {
            InterpolateCameraPos(playerid, 329.131469, -1791.461791, 15.695193, 326.005981, -1793.169311, 15.695193, 3000);
            InterpolateCameraLookAt(playerid, 326.451660, -1787.321044, 14.874702, 323.228546, -1789.171630, 14.553024, 3000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 3000-600, 0, "id", playerid, 11);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role P");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 11:
        {
            InterpolateCameraPos(playerid, 514.983886, -1760.605102, 17.303379, 514.898010, -1760.553955, 18.443613, 3000);
            InterpolateCameraLookAt(playerid, 519.002807, -1762.556640, 15.058471, 519.071899, -1762.496826, 16.493217, 3000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 3000-600, 0, "id", playerid, 12);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role Pl");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 12:
        {
            InterpolateCameraPos(playerid, 524.473022, -1763.555786, 14.948656, 524.520751, -1763.556152, 15.495350, 5000);
            InterpolateCameraLookAt(playerid, 519.486999, -1763.304687, 14.671454, 519.540893, -1763.958007, 15.296504, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 13);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role Pla");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 13:
        {
            InterpolateCameraPos(playerid, 545.416076, -1772.326171, 8.179362, 547.233886, -1774.291870, 8.147984, 5000);
            InterpolateCameraLookAt(playerid, 548.811035, -1775.996459, 8.120770, 550.628845, -1777.962158, 8.089392, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 14);
            PlayerTextDrawSetString(playerid, roleplay[playerid], "eXtreme Role Play");
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
        }
        case 14:
        {
            InterpolateCameraPos(playerid, 550.013793, -1772.057128, 16.024028, 552.169799, -1772.079223, 16.285087, 5000);
            InterpolateCameraLookAt(playerid, 546.803894, -1768.331054, 15.122734, 548.959899, -1768.353149, 15.383792, 5000);
            SetTimerEx("OnPlayerFinishInterpolateCamera", 5000-600, 0, "id", playerid, 15);
            TextDrawShowForPlayer(playerid, roleplaybox);
            for(new i = 0; i != 32; i++) SendClientMessage(playerid, -1, " ");
            HasSeenIntro[playerid] = 1;
            ForceClassSelection(playerid);
            TogglePlayerSpectating(playerid, true);
            TogglePlayerSpectating(playerid, false);
        }
    }
}
I took the original script from the link you gave me and I uploaded it to pastebin before I saw this, so I may as well show you what I did.
http://pastebin.com/2srUmuwa
You may notice some things in there and change them up to help optimize your code.
Reply
#7

Yup code is too much same and better, thanks man!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)