3 posts in this topic

RASTAMAN

В этой теме будет система Конвоя.

Спойлер

if(strcmp(cmd, "/konvoy", true) == 0)
        {
                new var[255];
                var = strtok(cmdtext, idx);
                if(!strlen(var)) return SendClientMessage(playerid, 0xAA3333AA, "Вы не ввели имя игрока");
                new gotplayer = strval(var);
                if(IsACop(playerid))
                {
                        if(playerid == gotplayer) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можите сопровождать самого себя ");
                        else if(!IsPlayerConnected(gotplayer)) return SendClientMessage(playerid, 0xAA3333AA, "Такого игрока нет на сервере");
                        else if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можете вести конвой с  машины!");
                        else if(FollowBy[playerid] != MAX_PLAYERSS) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можете взять игрока под конвой, когда сами конвоируетесь!");
                        else if(IsPlayerInAnyVehicle(gotplayer)) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можете взять под конвой когда игрок в машине!");
                        new Float: X, Float: Y, Float: Z; GetPlayerPos(gotplayer, X, Y, Z);
                        if(!IsPlayerInRangeOfPoint(playerid, 1.5, X, Y, Z)) return SendClientMessage(playerid, 0xAA3333AA, "Игрок далеко от вас!");
                        else if(FollowBy[gotplayer] != MAX_PLAYERS)
                        {
                                //if(FollowBy[gotplayer] != playerid)
                                SetPVarInt(playerid, "TempFollowBy", -1);
                                FollowBy[gotplayer] = MAX_PLAYERS;
                                KillTimer(TimerForPlayer[gotplayer]);
                                TimerForPlayer[gotplayer] = MAX_PLAYERS;
                                ClearAnimations(playerid);
                                TogglePlayerControllable(gotplayer, 1);
                                SendClientMessage(playerid, 0x33AA33AA, "Вы успешно установили конвой за игроком!");
                                return SendClientMessage(gotplayer, 0xFFFF00AA, "С вас был снят конвой!");
                        }
                        if(GetPVarInt(playerid, "TempFollowBy") != -1) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можете сопровождать больше 2х игроков одновременно!");
                        FollowBy[gotplayer] = playerid;
                        SetPVarInt(playerid, "TempFollowBy", gotplayer);
                        TimerForPlayer[gotplayer] = SetTimerEx("FollowToPlayer", 1000, 1, "i", gotplayer);
                        SendClientMessage(playerid, 0x33AA33AA, "Вы успешно начали сопровождение этого игрока!");
                        return SendClientMessage(gotplayer, 0xFFFF00AA, "Вас взяли под конвой");
                }
        }

 

Вводя команду и указывая ид игрока, она будет вполне рабочая. И тот игрок которого вы хотели бы взять под конвой будет следовать за вами

Спойлер

#define gpvi GetPVarInt
#define spvi SetPVarInt

 

Спойлер

new FollowBy[MAX_PLAYERS];
new TimerForPlayer[MAX_PLAYERS];

 

Спойлер

TimerForPlayer[playerid] = MAX_PLAYERS;
FollowBy[playerid] = MAX_PLAYERS;
SetPVarInt(playerid, "TempFollowBy", -1);

 

Спойлер

    new GotPVar = GetPVarInt(playerid, "TempFollowBy");
if(FollowBy[playerid] != MAX_PLAYERSS)
{
        SetPVarInt(FollowBy[playerid], "TempFollowBy", -1);
        KillTimer(TimerForPlayer[playerid]);
        SendClientMessage(FollowBy[playerid], COLOR_LIGHTBLUE, "Ваш заключенный мертв");
        TimerForPlayer[playerid] = MAX_PLAYERS;
        FollowBy[playerid] = MAX_PLAYERS;
}
else if(GotPVar != -1)
{
        SetPVarInt(playerid, "TempFollowBy", -1);
        KillTimer(TimerForPlayer[GotPVar]);
        SendClientMessage(FollowBy[playerid], COLOR_LIGHTBLUE, "Ваш конвой мертв.");
        TimerForPlayer[GotPVar] = MAX_PLAYERS;
        FollowBy[GotPVar] = MAX_PLAYERS;
}

 

Спойлер

   new GotPVar = GetPVarInt(playerid, "TempFollowBy");
if(FollowBy[playerid] != MAX_PLAYERS)
{
        SetPVarInt(FollowBy[playerid], "TempFollowBy", -1);
        KillTimer(TimerForPlayer[playerid]);
        SendClientMessage(FollowBy[playerid], COLOR_LIGHTBLUE, "Ваш заключенный мертв.");
        TimerForPlayer[playerid] = MAX_PLAYERSS;
        FollowBy[playerid] = MAX_PLAYERS;
}
else if(GotPVar != -1)
{
        SetPVarInt(playerid, "TempFollowBy", -1);
        KillTimer(TimerForPlayer[GotPVar]);
        SendClientMessage(FollowBy[playerid], COLOR_LIGHTBLUE, "Ваш конвой мертв.");
        TimerForPlayer[GotPVar] = MAX_PLAYERS;
        FollowBy[GotPVar] = MAX_PLAYERS;
}

 

Спойлер

forward FollowToPlayer(playerid);
public FollowToPlayer(playerid)
{
        static AnimShot[MAX_PLAYERSS];
        if(!IsPlayerConnected(FollowBy[playerid]))
        {
                KillTimer(TimerForPlayer[playerid]);
                TimerForPlayer[playerid] = MAX_PLAYERS;
                FollowBy[playerid] = MAX_PLAYERS;
                TogglePlayerControllable(playerid, 1);
                ClearAnimations(playerid);
                AnimShot[playerid] = false;
                SendClientMessage(playerid, 0xFFFF00AA, "Вы свободны, конвой покинул сервер!");
                return 1;
        }
        else if(!IsPlayerConnected(playerid))
        {
                SetPVarInt(FollowBy[playerid], "TempFollowBy", -1);
                KillTimer(TimerForPlayer[playerid]);
                TimerForPlayer[playerid] = MAX_PLAYERS;
                AnimShot[playerid] = false;
                SendClientMessage(FollowBy[playerid], 0xFFFF00AA, "Арестованный покинул сервер!");
                FollowBy[playerid] = MAX_PLAYERS;
                return 1;
        }
        else if(FollowBy[playerid] == MAX_PLAYERSS)
        {
                KillTimer(TimerForPlayer[playerid]);
                TimerForPlayer[playerid] = MAX_PLAYERS;
                AnimShot[playerid] = false;
                SendClientMessage(playerid, 0xFFFF00AA, "С вашем конвоем произошла беда, вы свободны !");
                TogglePlayerControllable(playerid, 1);
                ClearAnimations(playerid);
                return 1;
        }
        else if(IsPlayerInAnyVehicle(playerid))
        {
                SetPVarInt(FollowBy[playerid], "TempFollowBy", -1);
                KillTimer(TimerForPlayer[playerid]);
                TimerForPlayer[playerid] = MAX_PLAYERS;
                AnimShot[playerid] = false;
                SendClientMessage(FollowBy[playerid], 0xFFFF00AA, "Ваш заключенный в машине. Конвой остановлен");
                FollowBy[playerid] = MAX_PLAYERS;
                return 1;
        }
        else if(GetPlayerVirtualWorld(FollowBy[playerid]) != GetPlayerVirtualWorld(playerid) || GetPlayerInterior(FollowBy[playerid]) != GetPlayerInterior(playerid))
        {
                new Float: X, Float: Y, Float: Z;
                GetPlayerPos(FollowBy[playerid], X, Y, Z);
                SetPlayerPos(playerid, X, Y, Z);
                SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(FollowBy[playerid]));
                SetPlayerInterior(playerid, GetPlayerInterior(FollowBy[playerid]));
                TogglePlayerControllable(playerid, 0);
                AnimShot[playerid] = false;
                return 1;
        }
        new Float: GotDistance = GetDistanceBetweenPlayers(playerid, FollowBy[playerid]);
        if(GotDistance < 0.95)
        {
                TogglePlayerControllable(playerid, 0);
                SetPlayerToFacePlayer(playerid, FollowBy[playerid]);
                AnimShot[playerid] = false;
                return 1;
        }
        else if(GotDistance > 10.0)
        {
                SetPVarInt(FollowBy[playerid], "TempFollowBy", -1);
                SendClientMessage(FollowBy[playerid], 0xFFFF00AA, "Вы ушли слишком далеко. Конвой закончен");
                SendClientMessage(playerid, 0xFFFF00AA, "Ваш конвой ушел слишком далеко, вы свободны.");
                TogglePlayerControllable(playerid, 1);
                ClearAnimations(playerid);
                KillTimer(TimerForPlayer[playerid]);
                TimerForPlayer[playerid] = MAX_PLAYERS;
                FollowBy[playerid] = MAX_PLAYERS;
                return 1;
        }
        else
        {
                TogglePlayerControllable(playerid, 1);
                SetPlayerToFacePlayer(playerid, FollowBy[playerid]);
                ApplyAnimation(playerid, "ped", "WALK_civi", 6.0, 1, 1, 1, 1, 0, 1);
        }
        return 1;
}

 

На этом система закончена.

Share this post


Link to post
Share on other sites
Спойлер

CMD:konvoy(playerid, params[])
{
  				new gotplayer;
				if(sscanf(params, "u", gotplayer)) return SendClientMessage(playerid, 0xAA3333AA, "Введите: /konvoy [id/PartOfName/Name]"); 
                if(IsACop(playerid))
                {
                        if(playerid == gotplayer) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можите сопровождать самого себя ");
                        else if(!IsPlayerConnected(gotplayer)) return SendClientMessage(playerid, 0xAA3333AA, "Такого игрока нет на сервере");
                        else if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можете вести конвой с  машины!");
                        else if(FollowBy[playerid] != MAX_PLAYERSS) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можете взять игрока под конвой, когда сами конвоируетесь!");
                        else if(IsPlayerInAnyVehicle(gotplayer)) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можете взять под конвой когда игрок в машине!");
                        new Float: X, Float: Y, Float: Z; GetPlayerPos(gotplayer, X, Y, Z);
                        if(!IsPlayerInRangeOfPoint(playerid, 1.5, X, Y, Z)) return SendClientMessage(playerid, 0xAA3333AA, "Игрок далеко от вас!");
                        else if(FollowBy[gotplayer] != MAX_PLAYERS)
                        {
                                //if(FollowBy[gotplayer] != playerid)
                                SetPVarInt(playerid, "TempFollowBy", -1);
                                FollowBy[gotplayer] = MAX_PLAYERS;
                                KillTimer(TimerForPlayer[gotplayer]);
                                TimerForPlayer[gotplayer] = MAX_PLAYERS;
                                ClearAnimations(playerid);
                                TogglePlayerControllable(gotplayer, 1);
                                SendClientMessage(playerid, 0x33AA33AA, "Вы успешно установили конвой за игроком!");
                                return SendClientMessage(gotplayer, 0xFFFF00AA, "С вас был снят конвой!");
                        }
                        if(GetPVarInt(playerid, "TempFollowBy") != -1) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можете сопровождать больше 2х игроков одновременно!");
                        FollowBy[gotplayer] = playerid;
                        SetPVarInt(playerid, "TempFollowBy", gotplayer);
                        TimerForPlayer[gotplayer] = SetTimerEx("FollowToPlayer", 1000, 1, "i", gotplayer);
                        SendClientMessage(playerid, 0x33AA33AA, "Вы успешно начали сопровождение этого игрока!");
                        return SendClientMessage(gotplayer, 0xFFFF00AA, "Вас взяли под конвой");
                }
        }

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • whccompany
      By whccompany
      Rostov Role Play | Rostov RP | CRMP Mobile Project объявляет набор людей в свою команду: Нам требуются:
       
      1. Маппера:
      Сдельная оплата труда от 250 до 3000 рублей/ за 1 работу
       
      2. Специалист по Text Draw:
      Сдельная оплата труда от 400 до 3500 рублей/ за одну работу
       
      3. Pawn разработчик:
      Заработная плата от 10 000 рублей/месяц
       
      4. Программист для создания лаунчера и сайта UCP с автодонатом:
      Заработная плата от 10 000 рублей/месяц
       
      Контакты для связи:
       
      ВКонтакте
       
      Telegram
       
    • Talex
      By Talex
      Игровой сервер Life Game RolePlay
      Скачать файл Игровой сервер Life Game RolePlay
      Добавил Talex Добавлено 28.01.2024 Категория Моды Автор Неизвестно  
    • Talex
      By Talex
      Игровой сервер Life Game RolePlay
    • Владислав2
      By Владислав2
      Здравствуйте, при компиляции появляется ошибка,

      Ошибка:
      error 017: undefined symbol "REP_KUZIA_TD"

      Строки:
       
          REP_KUZIA_TD[0] = TextDrawCreate(7.499990, 314.444396, "REP: 1");
          TextDrawLetterSize(REP_KUZIA_TD[0], 0.400000, 1.600000);
          TextDrawAlignment(REP_KUZIA_TD[0], 1);
          TextDrawColor(REP_KUZIA_TD[0], -1);
          TextDrawSetShadow(REP_KUZIA_TD[0], 0);
          TextDrawSetOutline(REP_KUZIA_TD[0], 1);
          TextDrawBackgroundColor(REP_KUZIA_TD[0], 255);
          TextDrawFont(REP_KUZIA_TD[0], 1);
          TextDrawSetProportional(REP_KUZIA_TD[0], 1);
          TextDrawSetShadow(REP_KUZIA_TD[0], 0);
          REP_KUZIA_TD[1] = TextDrawCreate(6.249957, 330.518493, "ASK: 0");
          TextDrawLetterSize(REP_KUZIA_TD[1], 0.400000, 1.600000);
          TextDrawAlignment(REP_KUZIA_TD[1], 1);
          TextDrawColor(REP_KUZIA_TD[1], -1);
          TextDrawSetShadow(REP_KUZIA_TD[1], 0);
          TextDrawSetOutline(REP_KUZIA_TD[1], 1);
          TextDrawBackgroundColor(REP_KUZIA_TD[1], 255);
          TextDrawFont(REP_KUZIA_TD[1], 1);
          TextDrawSetProportional(REP_KUZIA_TD[1], 1);
          TextDrawSetShadow(REP_KUZIA_TD[1], 0);
          return 1;
      }

      Буду рад если кто-то поможет