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

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

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

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

FPS + Ping

Regisss

Изучающий
Пользователь
Регистрация
23 Апр 2016
Сообщения
145
Лучшие ответы
1
Репутация
58
Данный скрипт позволяет игрокам видеть их fps и ping на textdraw'е.

P.S. для данного скрипта не нужны cleo и т.д.
P.P.S. - цвет FPS и PING'а будет меняться в зависимости от их значения. (30, 60, 90)

Скрин:

У кого не грузит -

И так, в начало мода:

PHP:
new Text:fpsdraw[MAX_PLAYERS];
new showfps[MAX_PLAYERS];
new fpsshowed[MAX_PLAYERS];
В паблики:

PHP:
OnPlayerConnect:

	fpsdraw[playerid] = TextDrawCreate(503.125000, 112.583335, "FPS: 228 PING: -1");
	TextDrawLetterSize(fpsdraw[playerid], 0.349999, 1.249999);
	TextDrawAlignment(fpsdraw[playerid], 1);
	TextDrawColor(fpsdraw[playerid], -1);
	TextDrawSetShadow(fpsdraw[playerid], 0);
	TextDrawSetOutline(fpsdraw[playerid], 1);
	TextDrawBackgroundColor(fpsdraw[playerid], 51);
	TextDrawFont(fpsdraw[playerid], 1);
	TextDrawSetProportional(fpsdraw[playerid], 1);

OnPlayerDisconnect:

TextDrawDestroy(fpsdraw[playerid]);
Ко всем стокам:

PHP:
stock UpdateFPS(playerid)
{
		    new fps[60],i = playerid,color[2][5];
                    switch(GetPlayerFPS(i))
                    {
		    case 0..29: color[0] = "~r~";
		    case 30..59: color[0] = "~y~";
		    default: color[0] = "~g~";
                    }
                    switch(GetPlayerPing(i))
                    {
		    case 0..29: color[1] = "~g~";
		    case 30..59: color[1] = "~y~";
		    default: color[1] = "~r~";
                    }
		    format(fps,sizeof(fps),"~w~FPS:%s %d ~w~PING:%s %d",color[0],GetPlayerFPS(i),color[1],GetPlayerPing(i));
		    TextDrawSetString(fpsdraw[playerid],fps);
		    TextDrawShowForPlayer(i,fpsdraw[i]);
}
stock GetPlayerFPS(playerid)
{
	SetPVarInt(playerid, "DrunkL", GetPlayerDrunkLevel(playerid));
	if(GetPVarInt(playerid, "DrunkL") < 100)
	{
        SetPlayerDrunkLevel(playerid, 2000);
	}
    else
	{
        if(GetPVarInt(playerid, "LDrunkL") != GetPVarInt(playerid, "DrunkL"))
		{
	        SetPVarInt(playerid, "FPS", (GetPVarInt(playerid, "LDrunkL") - GetPVarInt(playerid, "DrunkL")));
	        SetPVarInt(playerid, "LDrunkL", GetPVarInt(playerid, "DrunkL"));
	        if((GetPVarInt(playerid, "FPS") > 0) && (GetPVarInt(playerid, "FPS") < 256))
			{
	  			return GetPVarInt(playerid, "FPS") - 1;
	     	}
		}
  	}
	return 0;
}
В 1-секундный таймер/OnPlayerUpdate:

PHP:
		if(fpsshowed[playerid] == 0 && showfps[playerid] == 1) { fpsshowed[playerid] = 1; TextDrawShowForPlayer(i, fpsdraw[i]); }
		if(fpsshowed[playerid] == 1 && showfps[playerid] == 0) { fpsshowed[playerid] = 0; TextDrawHideForPlayer(i, fpsdraw[i]); }
		if(fpsshowed[playerid] == 1 && showfps[playerid] == 1) UpdateFPS(i);
Теперь вы можете использовать скрипт! Чтобы включить/выключить его просто впишите в настройки или в нужное для вас место:

PHP:
showfps[playerid] = 1; // вкл
showfps[playerid] = 0; // выкл
Надеюсь, + заслужил ;)
 
Последнее редактирование:
Сверху Снизу