(Scr) Гонки

Готовые решения скриптов, filterScript

Moderator: SJplayer

Avatar
Topic author
Дим M
Администратор
Администратор
Posts: 1320
With us: 7 years 6 months

(Scr) Гонки

Post #1by Дим » 7 May 2013, 16:04

(Scr) Гонки

Данная команда (/drag) позволяют создать гонку, с денежным призом за первое место.

Ко всем new

Code: Select all

new Racecars[MAX_VEHICLES];
new Racing = 0;
new InRace[MAX_PLAYERS] = 0;
new RaceCount = 9;
new Timer;
new Race = 0;
new RaceCountText[9][5] ={
"~r~1",
"~r~2",
"~r~3",
"~b~4",
"~b~5",
"~P~6",
"~P~7",
"~P~8",
"~P~9"
};

new Float:Races[14][10] = {
{-
2007.7424,1039.4270,55.4653,-2001.7515,1039.6848,55.4716,179.6279,-2006.0970,-288.6483,35.2159},
{
2077.6108,1710.8317,10.3987,2077.6138,1714.0615,10.4074,90.2204,1571.5835,1713.3442,10.6719},
{
2529.9885,2051.6018,10.5149,2525.2722,2051.6577,10.5185,1.6527,2525.8257,2531.8552,10.5474},
{-
1900.0292,-213.7213,37.8068,-1895.1334,-213.6595,37.8152,181.5819,-1900.7362,-1341.0972,39.8433},
{-
79.4607,2494.6091,16.0558,-79.4496,2509.1399,16.0561,271.8271,385.4214,2501.8755,16.4844},
{-
2169.7446,-156.1234,34.8990,-2164.7539,-155.8840,34.8990,358.8846,-2142.5635,1182.1735,55.3052},
{-
2367.9126,1180.4299,40.4233,-2367.6951,1173.6318,40.4423,271.0974,-1565.8992,1184.4673,6.9120},
{-
2677.0017,1340.3302,55.1568,-2671.2561,1340.6523,55.1568,0.4735,-2675.3992,2185.5337,55.1490},
{-
879.4459,-1123.4261,98.6325,-883.6422,-1127.1022,98.9768,46.3483,-1252.9570,-740.0648,63.9632},
{-
1653.9194,404.6245,6.7583,-1649.4785,400.2170,6.7583,134.6043,-1566.4578,-1440.2993,40.5064},
{-
2708.2002,-211.1537,3.9068,-2704.7681,-212.4019,3.9068,358.9154,-2706.3320,376.0978,4.6971},
{-
1984.9625,-1184.0566,39.2115,-1991.0786,-1184.2036,39.2115,358.6819,-1984.7739,-519.3524,35.0630},
{-
1394.7531,-214.3255,1042.7404,-1400.1091,-214.4988,1042.7325,1.2286,-1395.9011,-224.4771,1043.1879},
{-
960.7573,2720.0149,46.1139,-960.1626,2713.9512,46.1311,98.7141,-1333.6216,1998.6085,53.0265}
};


Ко всем forward

Code: Select all

forward CountDown();
forward RaceEnd();


В public OnPlayerConnect(playerid)

Code: Select all

  DisablePlayerRaceCheckpoint(playerid);


В public OnPlayerCommandText(playerid, cmdtext[])

Code: Select all

    new string[256];
    if(strcmp(cmdtext,"/drag",true)==&& InRace[playerid] != 1)
        {
        if(Racing == 2) return SendClientMessage(playerid,0x919191FF," Гонка так и не началась");
        if(IsPlayerInAnyVehicle(playerid))
              {
                new rand = Race;
                if(Racing == 0)
                {
                SetPlayerInterior(playerid,0);
                ResetPlayerWeapons(playerid);
                Racecars[0]=GetPlayerVehicleID(playerid);
                SetVehiclePos(Racecars[0],Races[rand][0],Races[rand][1],Races[rand][2]);
                SetVehicleZAngle(Racecars[0],Races[rand][6]);
                AddVehicleComponent(Racecars[0], 1009);
                InRace[playerid] = 1;
                TogglePlayerControllable(playerid,false);
                format(string, sizeof(string), "(/DRAGRACE) %s подлкючился к DRAGRACE гонкам!", Player(playerid));
                SendClientMessageToAll(0x919191FF, string);
                SendClientMessage(playerid,0x919191FF," Ждите пока кто то зайдет в гонку или выйдите с гонки командой /dragexit");
                if(rand == 12)
                    {
                    LinkVehicleToInterior(Racecars[0],7);
                    SetPlayerInterior(playerid,7);
                    }
                }
                if(Racing == 1)
                {
                SetPlayerInterior(playerid,0);
                ResetPlayerWeapons(playerid);
                Racecars[1]=GetPlayerVehicleID(playerid);
                SetVehiclePos(Racecars[1],Races[rand][3],Races[rand][4],Races[rand][5]);
                SetVehicleZAngle(Racecars[1],Races[rand][6]);
                AddVehicleComponent(Racecars[1], 1009);
                InRace[playerid] = 1;
                TogglePlayerControllable(playerid,false);
                format(string, sizeof(string), "(/DRAGRACE) %s подлкючился к DRAGRACE гонкам!", Player(playerid));
                SendClientMessageToAll(0x919191FF, string);
                SendClientMessageToAll(0x919191FF,"(/DRAGRACE) ДРАГ ГОНКИ НАЧАЛИСЬ!!!");
                CountDown();
                if(rand == 12)
                    {
                    LinkVehicleToInterior(Racecars[1],7);
                    SetPlayerInterior(playerid,7);
                    }
                }
                Racing++;
                return 1;
            }
        else
            
{
            SendClientMessage(playerid, 0x919191FF, "*ВЫ ДОЛЖНЫ БЫТЬ В АВТОМОБИЛЕ!");
            return 1;
            }
    }

    if(strcmp(cmdtext,"/dragexit",true)==0)
    {
        new pwn[256];
        format(pwn,sizeof(pwn),"(/DRAGRACE) %s вышел с DRAGRACE",Player(playerid));
        SendClientMessageToAll(0x919191FF,pwn);
        Racing = 0;
        KillTimer(Timer);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
        if(InRace[i] == 1)
            {
            if(Race == 12)
                   {
                LinkVehicleToInterior(GetPlayerVehicleID(i),0);
                }
            InRace[i] = 0;
            SetPlayerInterior(i, 0);
            SetVehiclePos(Racecars[0],-2007.7424,1039.4270,55.4653);
            SetVehiclePos(Racecars[1],-2001.7515,1039.6848,55.4716);
            DisablePlayerRaceCheckpoint(i);
            TogglePlayerControllable(i,true);
            }
        }
        return 1;
    }


Создаём public CountDown()

Code: Select all

public CountDown()
{
    if (RaceCount > 0)
        {
        new rand = Race;
        SetVehiclePos(Racecars[0],Races[rand][0],Races[rand][1],Races[rand][2]);
        SetVehiclePos(Racecars[1],Races[rand][3],Races[rand][4],Races[rand][5]);
        SetVehicleZAngle(Racecars[0],Races[rand][6]);
        SetVehicleZAngle(Racecars[1],Races[rand][6]);
        RaceCount--;
        SetTimer("CountDown", 1000, 0);
        for(new i=0; i<MAX_PLAYERS; i++)
            {
            if(InRace[i])
                {
                GameTextForPlayer(i, RaceCountText[RaceCount-1], 2500, 3);
                }
            }
        }
    else
        
{
        for(new i=0; i<MAX_PLAYERS; i++)
            {
            if(InRace[i])
                {
                new rand = Race;
                SendClientMessage(i,0x919191FF," У вас есть 1 минута что бы закончить гонку или она автоматически закончится");
                TogglePlayerControllable(i,true);
                GameTextForPlayer(i,"~g~Go! Go! Go!", 2500, 3);
                SetPlayerRaceCheckpoint(i,1,Races[rand][7],Races[rand][8],Races[rand][9],Races[rand][3],Races[rand][4],Races[rand][5],5);
                }
            }
        Timer = SetTimer("RaceEnd",60000,0);
        RaceCount = 5;
        }
    return 1;

}


и public RaceEnd()

Code: Select all

public RaceEnd()
{
    if(Race == 13)
        {
        Race = -1;
        }
    SendClientMessageToAll(0x919191FF,"(/DRAGRACE) ДРАГ ГОНКА ЗАКОНЧИЛАСЬ");
    Racing = 0;
    Race++;
    for(new i=0; i<MAX_PLAYERS; i++)
        {
        if(InRace[i] == 1)
            {
            InRace[i] = 0;
            SetPlayerInterior(i, 0);
            DisablePlayerRaceCheckpoint(i);
            SetVehiclePos(Racecars[0],-2007.7424,1039.4270,55.4653);
            SetVehiclePos(Racecars[1],-2001.7515,1039.6848,55.4716);
            }
        }
    return 1;
}
Player(playerid)
{
 new player[MAX_PLAYER_NAME];
 GetPlayerName(playerid, player, sizeof(player));
 return player;
}


В public OnPlayerEnterRaceCheckpoint(playerid)

Code: Select all

    new pwn[256];
    if(InRace[playerid] == 1)
    {
        if(Race == 13)
            {
            Race = -1;
            }
        if(Race == 12)
               {
            LinkVehicleToInterior(GetPlayerVehicleID(playerid),0);
            }
        format(pwn,sizeof(pwn),"(/DRAGRACE) %s выиграл в драг гонке!!!",Player(playerid));
        SendClientMessageToAll(0x919191FF,pwn);
        GameTextForPlayer(playerid,"B‘ ~g~B‘…‚PA‡… ~w~‚OHKY",5000,5);
        GivePlayerMoney(playerid, 100);//приз за 1 место
        Racing = 0;
        KillTimer(Timer);
        Race++;
        for(new i=0; i<MAX_PLAYERS; i++)
            {
            if(InRace[i] == 1)
                {
                InRace[i] = 0;
                SetPlayerInterior(i, 0);
                SetVehiclePos(Racecars[0],-2007.7424,1039.4270,55.4653);
                SetVehiclePos(Racecars[1],-2001.7515,1039.6848,55.4716);
                DisablePlayerRaceCheckpoint(i);
                }
            }
    }
i love you mxIni Mysql

! ! !


  • Similar Topics
    Replies
    Views
    Last post

Return to “Скрипты / FS”

Who is online

Users browsing this forum: 1 guest