Доступ к готовым решениям

Переход в группу "Пользователь"

300.00 ₽
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info

Мануал Система преследований [TD]

-WorcOut-

«I'am WorcOut» ♫
[HR][/HR]
[HR][/HR]
Нам потребуются include
#include <sscanf2>
#include <foreach>
#include <zcmd>
​

[HR][/HR]
Далее ко всем переменным добавим.
PHP:
new GameName[MAX_PLAYERS][MAX_PLAYER_NAME];
// Отвечает за ник
new pStar[MAX_PLAYERS];
// уровень розыска

new PlayerText:textdraw_suspect[MAX_PLAYERS][11];
// ОСНОВА
new PlayerText:textdraw_su[1];
// Маркер
[HR][/HR]
Далее в команды добавим.
PHP:
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;
}
[HR][/HR]
В OnPlayerConnect, где у вас персон. td добавим
PHP:
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);
[HR][/HR]

После в OnGameModeInit добавим таймер... И маркер на карте
PHP:
ShowPlayerMarkers(1);
	ShowNameTags(1);
        SetTimer("@__update_time", 1000, true);
[HR][/HR]
Далее основа, создаём сток где само взаимодействия , тд с системой
PHP:
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;
}
[HR][/HR]
После сам таймер
PHP:
@__update_time();
@__update_time()
{
	foreach(new i:Player)
	{
		if ( GetPVarInt( i , !"player_suspect" ) == 1 ) textdraw_update_info(i , GetPVarInt( i , !"SuID" ) ) ;
	}
	return 1;
}
[HR][/HR]

Далее идём в паблик OnPlayerDeath, то есть при смерти тд исчезал.


PHP:
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 ) ;
	}
PHP:
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] = '&#152;';
		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;
}
​
 
Последнее редактирование:
Сверху Снизу