В теме 5 сообщений

Великий Гуру

Всем привет, сегодня выкладываю систему преследования за преступником на достаточно красивых текстдравах (TD). Система для модов SAMP. 

Спойлер

dIGnTAg2r-g.jpg.38c0b2d52ffb54070a0de34dfc8f537b.jpg

 

Зависимости
Тип Название
Плагин + инклуд sscanf2
Инклуд (+плагин) zcmd / dc_cmd / Pawn.CMD
Инклуд foreach

 

Перейдем к коду. 


Ко всем переменным: 

new GameName[MAX_PLAYERS][MAX_PLAYER_NAME];
// Отвечает за ник
new pStar[MAX_PLAYERS];
// уровень розыска

new PlayerText:textdraw_suspect[MAX_PLAYERS][11];
// ОСНОВА
new PlayerText:textdraw_su;
// Маркер  

Ко всем командам: 

CMD:su(playerid,params[])
{
  if( GetPVarInt( playerid , !"player_suspect" ) )
  {
    for ( new i ; i < 11 ; i++ ) PlayerTextDrawHide ( playerid , textdraw_suspect[playerid][ i ] ) ;
    DeletePVar( playerid , !"player_suspect_id" ) ;
    DeletePVar( playerid , !"player_suspect" ) ;
    DisablePlayerRaceCheckpoint ( playerid ) ;
    return 1;
  }
  if(sscanf(params,"u",params[0]))
    return SendClientMessage(playerid,-1,"Используйте: /su [ID]");

  if(!IsPlayerConnected(params[0]))
    return 1;

  for(new i; i < 11; i++) PlayerTextDrawShow ( playerid , textdraw_suspect[playerid][ i ] ) ;
  SetPVarInt( playerid , !"player_suspect_id" , params[0] ) ;
  SetPVarInt( playerid , !"player_suspect" , 1 ) ;
  textdraw_update_info( playerid , params [0] ) ;
  return 1;
}  
Спойлер

textdraw_su[0] = CreatePlayerTextDraw(playerid, 443.452362, 219.366668, "");
    PlayerTextDrawLetterSize(playerid, textdraw_su[0], 0.000000, 0.000000);
    PlayerTextDrawTextSize(playerid, textdraw_su[0], 69.000000, 80.000000);
    PlayerTextDrawAlignment(playerid, textdraw_su[0], 1);
    PlayerTextDrawColor(playerid, textdraw_su[0], -1);
    PlayerTextDrawSetShadow(playerid, textdraw_su[0], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_su[0], 0);
    PlayerTextDrawBackgroundColor(playerid, textdraw_su[0], -865543936);
    PlayerTextDrawFont(playerid, textdraw_su[0], 5);
    PlayerTextDrawSetProportional(playerid, textdraw_su[0], 0);
    PlayerTextDrawSetShadow(playerid, textdraw_su[0], 0);
    PlayerTextDrawSetPreviewModel(playerid, textdraw_su[0], 19253);
    PlayerTextDrawSetPreviewRot(playerid, textdraw_su[0], 90.000000, 0.000000, 0.000000, 1.000000);

    textdraw_suspect[playerid][0] = CreatePlayerTextDraw(playerid, 630.755371, 210.333343, "usebox");
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][0], 0.000000, 0.914812);
    PlayerTextDrawTextSize(playerid, textdraw_suspect[playerid][0], 470.737915, 0.000000);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][0], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][0], 0);
    PlayerTextDrawUseBox(playerid, textdraw_suspect[playerid][0], true);
    PlayerTextDrawBoxColor(playerid, textdraw_suspect[playerid][0], -5963521);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][0], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][0], 0);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][0], 0);

    textdraw_suspect[playerid][1] = CreatePlayerTextDraw(playerid, 631.287231, 223.583328, "usebox");
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][1], 0.000000, 18.906024);
    PlayerTextDrawTextSize(playerid, textdraw_suspect[playerid][1], 470.737915, 0.000000);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][1], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][1], 0);
    PlayerTextDrawUseBox(playerid, textdraw_suspect[playerid][1], true);
    PlayerTextDrawBoxColor(playerid, textdraw_suspect[playerid][1], 151587327);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][1], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][1], 0);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][1], 0);

    textdraw_suspect[playerid][2] = CreatePlayerTextDraw(playerid, 472.737945, 222.249984, "samaps:map");
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][2], 0.000000, 0.000000);
    PlayerTextDrawTextSize(playerid, textdraw_suspect[playerid][2], 156.486068, 131.833343);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][2], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][2], -1);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][2], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][2], 0);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][2], 4);

    textdraw_suspect[playerid][3] = CreatePlayerTextDraw(playerid, 513.968566, 208.249938, TranslateText("Погоня за преступником"));
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][3], 0.141713, 1.180000);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][3], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][3], -1);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][3], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][3], 0);
    PlayerTextDrawBackgroundColor(playerid, textdraw_suspect[playerid][3], 51);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][3], 2);
    PlayerTextDrawSetProportional(playerid, textdraw_suspect[playerid][3], 1);

    textdraw_suspect[playerid][4] = CreatePlayerTextDraw(playerid, 615.356994, 359.499938, "usebox");
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][4], 0.000000, 0.774256);
    PlayerTextDrawTextSize(playerid, textdraw_suspect[playerid][4], 487.604888, 0.000000);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][4], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][4], 0);
    PlayerTextDrawUseBox(playerid, textdraw_suspect[playerid][4], true);
    PlayerTextDrawBoxColor(playerid, textdraw_suspect[playerid][4], -5963521);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][4], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][4], 0);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][4], 0);

    textdraw_suspect[playerid][5] = CreatePlayerTextDraw(playerid, 615.419982, 372.749938, "usebox");
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][5], 0.000000, 0.727404);
    PlayerTextDrawTextSize(playerid, textdraw_suspect[playerid][5], 487.604888, 0.000000);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][5], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][5], 0);
    PlayerTextDrawUseBox(playerid, textdraw_suspect[playerid][5], true);
    PlayerTextDrawBoxColor(playerid, textdraw_suspect[playerid][5], -5963521);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][5], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][5], 0);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][5], 0);

    textdraw_suspect[playerid][6] = CreatePlayerTextDraw(playerid, 615.482849, 385.416595, "usebox");
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][6], 0.000000, 0.727404);
    PlayerTextDrawTextSize(playerid, textdraw_suspect[playerid][6], 487.604919, 0.000000);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][6], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][6], 0);
    PlayerTextDrawUseBox(playerid, textdraw_suspect[playerid][6], true);
    PlayerTextDrawBoxColor(playerid, textdraw_suspect[playerid][6], -5963521);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][6], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][6], 0);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][6], 0);

    textdraw_suspect[playerid][7] = CreatePlayerTextDraw(playerid, 491.010223, 356.416625, TranslateText("Розыскиваемый: Cub_Anderson"));
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][7], 0.174977, 1.279165);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][7], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][7], -1);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][7], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][7], 0);
    PlayerTextDrawBackgroundColor(playerid, textdraw_suspect[playerid][7], 51);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][7], 2);
    PlayerTextDrawSetProportional(playerid, textdraw_suspect[playerid][7], 1);

    textdraw_suspect[playerid][8] = CreatePlayerTextDraw(playerid, 491.073150, 368.499938, TranslateText("Количество звезд: 3"));
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][8], 0.174977, 1.279165);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][8], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][8], -1);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][8], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][8], 0);
    PlayerTextDrawBackgroundColor(playerid, textdraw_suspect[playerid][8], 51);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][8], 2);
    PlayerTextDrawSetProportional(playerid, textdraw_suspect[playerid][8], 1);

    textdraw_suspect[playerid][9] = CreatePlayerTextDraw(playerid, 491.668060, 381.583312, TranslateText("Расстояние: 300km"));
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][9], 0.174977, 1.279165);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][9], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][9], -1);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][9], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][9], 0);
    PlayerTextDrawBackgroundColor(playerid, textdraw_suspect[playerid][9], 51);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][9], 2);
    PlayerTextDrawSetProportional(playerid, textdraw_suspect[playerid][9], 1);
    PlayerTextDrawSetSelectable(playerid, textdraw_suspect[playerid][9], true);

    textdraw_suspect[playerid][10] = CreatePlayerTextDraw(playerid, 483.513916, 268.333312, "hud:radar_light");
    PlayerTextDrawLetterSize(playerid, textdraw_suspect[playerid][10], 0.000000, 0.000000);
    PlayerTextDrawTextSize(playerid, textdraw_suspect[playerid][10], 10.775970, 11.666687);
    PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][10], 1);
    PlayerTextDrawColor(playerid, textdraw_suspect[playerid][10], -1);
    PlayerTextDrawSetShadow(playerid, textdraw_suspect[playerid][10], 0);
    PlayerTextDrawSetOutline(playerid, textdraw_suspect[playerid][10], 0);
    PlayerTextDrawFont(playerid, textdraw_suspect[playerid][10], 4);  

 

В OnGameModeInit: 

ShowPlayerMarkers(1);
ShowNameTags(1);
SetTimer("@__update_time", 1000, true);  

Ко всем стокам / в конец мода: 

Спойлер

stock textdraw_update_info(playerid,textdraw_sud)
{
  new
    Float:p[6],
    str[128];

  GetPlayerPos(playerid, p[0] , p[1] ,p[2] ) ;

  GetPlayerPos(textdraw_sud, p[3] , p[4] , p[5] ) ;

  format(str,sizeof(str) , TranslateText("Розыскиваемый: %s") , GameName[textdraw_sud]);
  PlayerTextDrawSetString(playerid, textdraw_suspect[playerid][7], str);

  format(str,sizeof(str) , TranslateText("Количество звезд: %d") , pStar[textdraw_sud]);
  PlayerTextDrawSetString(playerid, textdraw_suspect[playerid][8], str);

  format(str,sizeof(str) , TranslateText("Расстояние: %.1f") , GetDistanceBetweenPoints(p[0], p[1], p[2], p[3], p[4], p[5]));
  PlayerTextDrawSetString(playerid, textdraw_suspect[playerid][9], str);

  if ( p[1] < -3000 || p[1] > 3000 || p[0] < -3000 || p[0] > 3000 )
    return 1 ;

  PlayerTextDrawHide ( playerid, textdraw_suspect[playerid][10] ) ;
  PlayerTextDrawDestroy ( playerid, textdraw_suspect[playerid][10] ) ;


  new 
    Float:POS[2],
  Float:PlayerPOS[3];
  GetPlayerPos(playerid,PlayerPOS[0],PlayerPOS[1],PlayerPOS[2]);

  if ( PlayerPOS[1] < 0 ) POS[1] = 282.685791 + 61 * -PlayerPOS[1] / 3000 ;//низ
  else if ( PlayerPOS[1] >= 0 ) POS[1] = 282.685791 - 70 * PlayerPOS[1] / 3000 ;//вверх
  if ( PlayerPOS[0] < 0 ) POS[0] = 535 - 88.5 * -PlayerPOS[0] / 3000 ; //слево
  else if ( PlayerPOS[0] >= 0 ) POS[0] = 535 + 88 * PlayerPOS[0] / 3000 ;//справо

  textdraw_suspect[playerid][10] = CreatePlayerTextDraw(playerid, POS[0],POS[1], "hud:radar_light");
  PlayerTextDrawTextSize(playerid, textdraw_suspect[playerid][10], 10.775970, 11.666687);
  PlayerTextDrawAlignment(playerid, textdraw_suspect[playerid][10], 1);
  PlayerTextDrawFont(playerid, textdraw_suspect[playerid][10], 4);

  GetPlayerPos(textdraw_sud,PlayerPOS[0],PlayerPOS[1],PlayerPOS[2]);

  if ( PlayerPOS[1] < 0 ) POS[1] = 282.685791 + 61 * -PlayerPOS[1] / 3000 ;//низ
  else if ( PlayerPOS[1] >= 0 ) POS[1] = 282.685791 - 70 * PlayerPOS[1] / 3000 ;//вверх
  if ( PlayerPOS[0] < 0 ) POS[0] = 535 - 88.5 * -PlayerPOS[0] / 3000 ; //слево
  else if ( PlayerPOS[0] >= 0 ) POS[0] = 535 + 88 * PlayerPOS[0] / 3000 ;//справо

  textdraw_su[0] = CreatePlayerTextDraw(playerid, POS[0],POS[1], "hud:radar_waypoint");
  PlayerTextDrawTextSize(playerid, textdraw_su[0], 10.000000, 8.000000);
  PlayerTextDrawAlignment(playerid, textdraw_su[0], 1);
  PlayerTextDrawFont(playerid, textdraw_su[0], 4);

  PlayerTextDrawShow ( playerid, textdraw_su[0] ) ;
  PlayerTextDrawShow ( playerid, textdraw_suspect[playerid][10] ) ;

  return 1;
} 

 

К таймерам / в конец мода: 

@__update_time();
@__update_time()
{
    foreach(new i:Player)
    {
        if ( GetPVarInt( i , !"player_suspect" ) == 1 ) textdraw_update_info(i , GetPVarInt( i , !"SuID" ) ) ;
    }
    return 1;
}  

В OnPlayerDeath: 

if(GetPVarInt( playerid , !"player_suspect" ) != 0 )
{
    for ( new i ; i < 11; i++ ) PlayerTextDrawHide ( playerid , textdraw_suspect[playerid] [ i ] ) ;
    DeletePVar ( playerid , !"player_suspect_id" ) ;
    DeletePVar ( playerid , !"player_suspect" ) ;
    DisablePlayerRaceCheckpoint ( playerid ) ;
}  
Спойлер

Добавить в конец мода: 


stock TranslateText(str[]) {
    new result[128];
    for(new i=0; i < 128; i++) {
        switch(str[i]) {
        case 'а':result[i] = 'a';
        case 'А':result[i] = 'A';
        case 'б':result[i] = '—';
        case 'Б':result[i] = 'Ђ';
        case 'в':result[i] = 'ў';
        case 'В':result[i] = '‹';
        case 'г':result[i] = '™';
        case 'Г':result[i] = '‚';
        case 'д':result[i] = 'љ';
        case 'Д':result[i] = 'ѓ';
        case 'е':result[i] = 'e';
        case 'Е':result[i] = 'E';
        case 'ё':result[i] = 'e';
        case 'Ё':result[i] = 'E';
        case 'ж':result[i] = '›';
        case 'Ж':result[i] = '„';
        case 'з':result[i] = 'џ';
        case 'З':result[i] = '€';
        case 'и':result[i] = 'њ';
        case 'И':result[i] = '…';
        case 'й':result[i] = 'њ';
        case 'Й':result[i] = '…';
        case 'к':result[i] = 'k';
        case 'К':result[i] = 'K';
        case 'л':result[i] = 'ћ';
        case 'Л':result[i] = '‡';
        case 'м':result[i] = 'Ї';
        case 'М':result[i] = 'M';
        case 'н':result[i] = '®';
        case 'Н':result[i] = '*';
        case 'о':result[i] = 'o';
        case 'О':result[i] = 'O';
        case 'п':result[i] = 'Ј';
        case 'П':result[i] = 'Њ';
        case 'р':result[i] = 'p';
        case 'Р':result[i] = 'P';
        case 'с':result[i] = 'c';
        case 'С':result[i] = 'C';
        case 'т':result[i] = '¦';
        case 'Т':result[i] = 'Џ';
        case 'у':result[i] = 'y';
        case 'У':result[i] = 'Y';
        case 'ф':result[i] = '˜';
        case 'Ф':result[i] = 'Ѓ';
        case 'х':result[i] = 'x';
        case 'Х':result[i] = 'X';
        case 'ц':result[i] = '*';
        case 'Ц':result[i] = '‰';
        case 'ч':result[i] = '¤';
        case 'Ч':result[i] = 'Ќ';
        case 'ш':result[i] = 'Ґ';
        case 'Ш':result[i] = 'Ћ';
        case 'щ':result[i] = 'Ў';
        case 'Щ':result[i] = 'Љ';
        case 'ь':result[i] = '©';
        case 'Ь':result[i] = '’';
        case 'ъ':result[i] = 'ђ';
        case 'Ъ':result[i] = '§';
        case 'ы':result[i] = 'Ё';
        case 'Ы':result[i] = '‘';
        case 'э':result[i] = 'Є';
        case 'Э':result[i] = '“';
        case 'ю':result[i] = '«';
        case 'Ю':result[i] = '”';
        case 'я':result[i] = '¬';
        case 'Я':result[i] = '•';
        default:result[i]=str[i];
        }
    }
    return result;
}  

 

На этом все, автор: -WokOut-

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
Новичок

Не вижу смысла от этой системы, ведь легче открыть карту в самой игре.

Но за старание держи огромный +

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Создать учетную запись

Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!


Регистрация нового пользователя

Войти

Уже есть аккаунт? Войти в систему.


Войти

  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

  • Похожий контент

    • От xDetik
      Приветствую.
      Сделал небольшой островок на некотором расстоянии от карты Сан-Андреса, хотел поставить там пикап, добавил пикап в мод, и после того как приехал на остров, пикап не видно. Но если на этом же пикапе поменять координаты на те, которые находятся на карте Сан-Андреса, то он становится виден. В чем может быть проблема?
    • От Daf
      Здравствуйте, знатоки Pawn. У меня возникла такая проблема, сейчас попробую расписать ее подробно:
      Я решил добавить в игру Real cars. Всё сделал правильно: подключил инклуд, знаю принцип добавление реал кара. Захожу в игру и вижу машину. Добавляю вторую — она тоже есть. Добавляю третью — снова всё нормально. Но когда я пытаюсь добавить четвёртую, игра крашится при входе.
      Не важно, какой ид авто я ставлю, менял модельки, переделал всё, но проблема остаётся. Думаю, вы сможете подсказать, как её решить.
      Include - m_custom_sync 1.0.0
      CreateVehicleVEx(npoType, npoId, modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay = 180, addsiren = 0, tc_veh = 0) {     new vehicle, custom_id = -1;     if(!(400 <= modelid <= 20000))     {         custom_id = GetSlotVehicleModelSync(modelid);         if(custom_id == -1) return print("daf top");         modelid = customVehModels[custom_id][ModelID];     } #include <m_custom-sync> #define M_CUSTOM_CustomForPlayers 1 #define M_CUSTOM_CustomForActors 1 #define M_CUSTOM_CustomForVehicles 1 public OnGameModeInit() {     AddVehicleSyncModel(560, 12500); // беха     AddVehicleSyncModel(560, 12600); // порш     AddVehicleSyncModel(579, 12700); // хамер     AddVehicleSyncModel(560, 19929); // чирик