Sign in to follow this  
Followers 0
Doc_Block

Система информационных окошек с помощью

2 posts in this topic

image.png&key=402209595b188ddb67d5e5dd20

______________________________________

Приветствую всех пользователей форума или просто гостей.

Хочу вам представить систему информационных окошек с помощью как в одиночной игре.

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

 

Сама система:

Спойлер

Ко всем new:

new PlayerText:INFO_BOX[2];

new bool:ShowInfoBox[MAX_PLAYERS];

 

Ко всем forward:

forward OnInfoBoxUpdate();
 

Добавляем в public OnGameModeInit:
SetTimer("OnInfoBoxUpdate", 1000, true);
 

Добавляем в public OnPlayerConnect:
CreateInfoBox(playerid, 450, 100);

ShowInfoBox[playerid] = false;

 

Создаём public (можно в самый конец мода):


public OnInfoBoxUpdate() 
{ 
	foreach(new i : Player) 
	{ 
		if(ShowInfoBox[i]) 
		{ 	
			if(GetPVarInt(i,"InfoBox") < gettime()) 
            { 
				PlayerTextDrawHide(i, INFO_BOX[1]); PlayerTextDrawHide(i, INFO_BOX[0]); ShowInfoBox[i] = false; 
			} 
		} 
	} 
}

Добавляем ко всем stock:
 


stock CreateInfoBox(playerid, Float:posX, Float:posY) 
{ 
  INFO_BOX[0] = CreatePlayerTextDraw(playerid, posX, posY, "usebox"); 
  SetPlayerTextDrawSettings(playerid, INFO_BOX[0],0,6.5, 185+posX,0, 1, 0, 0,0,110, 0,0, false, true, false); 
  INFO_BOX[1] = CreatePlayerTextDraw(playerid, posX, posY+0.5, ""); 
  SetPlayerTextDrawSettings(playerid, INFO_BOX[1],0.42,2, 0,0, 1, 1, 0xB6B2B5FF,0,0, 0,0, false, false, true); 
  return true; 
} 
stock DrawInfoBoxForPlayer(playerid, message[], time) 
{ 
  new lines; for(new i = 0; i < strlen(message); i++) 
  { 
    switch(message[i]) 
    { 
      case 'n': lines++; 
    } 
  } 
  PlayerTextDrawLetterSize(playerid, INFO_BOX[0], 0, (lines+1) * 2.16); 
  PlayerTextDrawSetString(playerid, INFO_BOX[1], message); 
  PlayerTextDrawShow(playerid, INFO_BOX[1]); 
  PlayerTextDrawShow(playerid, INFO_BOX[0]); 
  SetPVarInt(playerid,"InfoBox",gettime() + time); 
  ShowInfoBox[playerid] = true; 
  return true; 
} 
stock SetPlayerTextDrawSettings(playerid, PlayerText:TextDraw, Float:Lsize1, Float:Lsize2, Float:Tsize1, Float:Tsize2, Alignment, Font, Color1, Color2, Color3, Shadows, Outline, bool:Selectable, bool:UseBox, bool:Proportional) 
{ 
  PlayerTextDrawLetterSize(playerid, TextDraw, Lsize1, Lsize2); 
  if(Tsize1 == 0 && Tsize2 == 0){} 
  else PlayerTextDrawTextSize(playerid, TextDraw, Tsize1, Tsize2); 
  PlayerTextDrawAlignment(playerid, TextDraw, Alignment); 
  PlayerTextDrawFont(playerid, TextDraw, Font); 
  PlayerTextDrawColor(playerid, TextDraw, Color1); 
  PlayerTextDrawBackgroundColor(playerid, TextDraw, Color2); 
  PlayerTextDrawBoxColor(playerid, TextDraw, Color3); 
  PlayerTextDrawSetShadow(playerid, TextDraw, Shadows); 
  PlayerTextDrawSetOutline(playerid, TextDraw, Outline); 
  PlayerTextDrawSetSelectable(playerid, TextDraw, Selectable); 
  PlayerTextDrawUseBox(playerid, TextDraw, UseBox); 
  PlayerTextDrawSetProportional(playerid, TextDraw, Proportional); 
  return true; 
}

Добавляем к командам:
 


if(!strcmp(cmd,"/connectfaq",true)) 
{ 
  new str[264]; 
  strcat(str, "~w~Welcome to -~n~"); 
  strcat(str, "~r~YourName RP!~n~"); 
  strcat(str, "~w~Good game you!"); 
  DrawInfoBoxForPlayer(playerid, str, 30); 
}

 

 

 

Пример работы:

Спойлер

QMiXEXd.png&hash=ed249bff28298fcce3bb492abd4a0938


Любые вопросы, пожелания и предложения жду в теме!

Share this post


Link to post
Share on other sites

Облегчил не поспорить, 2 сообщения а выглядит как 10 команд

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

    • Kutuzov
      By Kutuzov
      Всем привет, хотелось бы спросить у тех, кто разбирается в PluginSDK.
      Какие есть источники, руководства, документации о PluginSDK?
      Я пока что ничего нормального не нахожу.
      Заранее спасибо 
    • Danila_Fazz
      By Danila_Fazz
      Добрый день вписал систему 3д номеров все запустилось, но когда создаю номера пишет что они записаны в бд но они не записываются в бд  когда еще раз отпровляю команду пишет опять что все записано, но не чо не записываеться когда компелирую мод показывает только варнинги 202 на разные строки
       
      C:\Users\Danila_Fazz\Desktop\Сервак\gamemodes\srp061.pwn(23135) : warning 202: number of arguments does not match definition
      C:\Users\Danila_Fazz\Desktop\Сервак\gamemodes\srp061.pwn(23162) : warning 202: number of arguments does not match definition
      C:\Users\Danila_Fazz\Desktop\Сервак\gamemodes\srp061.pwn(23199) : warning 202: number of arguments does not match definition
      C:\Users\Danila_Fazz\Desktop\Сервак\gamemodes\srp061.pwn(23288) : warning 202: number of arguments does not match definition
      C:\Users\Danila_Fazz\Desktop\Сервак\gamemodes\srp061.pwn(23335) : warning 202: number of arguments does not match definition
      C:\Users\Danila_Fazz\Desktop\Сервак\gamemodes\srp061.pwn(23388) : warning 202: number of arguments does not match definition
      C:\Users\Danila_Fazz\Desktop\Сервак\gamemodes\srp061.pwn(23397) : warning 202: number of arguments does not match definition
      Pawn compiler 3.10.20150531              Copyright (c) 1997-2006, ITB CompuPhase
      Header size:          18160 bytes
      Code size:          8734120 bytes
      Data size:          3641416 bytes
      Stack/heap size:      16384 bytes; estimated max. usage=6660 cells (26640 bytes)
      Total requirements:12410080 bytes
      7 Warnings.
      на каждой этой страке находиться   if(IsPlayerAdmin(playerid, 7)) return 1;