Herro[CM] |
Дата: Среда, 09.09.2015, 20:18 | Сообщение # 1
|
Бывалый
Сообщений: 425
Статус: Offline
|
Приветствую вас, хочу продемонстрировать вам include под названием "Info Box". Лично использую данный include при выводе информации во время регистрации.
Функция: Код ShowPlayerInfoBox(playerid , title[] , informations[] , TitleBoxColor = 0 , BaseBoxColor = 0) Предупреждение! LoadInfoBox должен находится В OnGameModeInit Или OnFilterScriptInit. Код LoadInfoBox () // Загрузить его
Сам include:
Код #include <a_samp>
new InInfoBoxMode[MAX_PLAYERS]; new Text:BaseBox[MAX_PLAYERS]; new Text:TitleName[MAX_PLAYERS]; new Text:Informations[MAX_PLAYERS]; new Text:ClosingText;
stock LoadInfoBox() {
for(new playerid=0; playerid!=MAX_PLAYERS; playerid++) {
BaseBox[playerid] = TextDrawCreate(239.600006, 124.700004, "usebox"); TextDrawLetterSize(BaseBox[playerid], 0.000000, 21.253700); TextDrawTextSize(BaseBox[playerid], 32.400001, 0.000000); TextDrawAlignment(BaseBox[playerid], 1); TextDrawColor(BaseBox[playerid], 51); TextDrawUseBox(BaseBox[playerid], true); TextDrawBoxColor(BaseBox[playerid], 102); TextDrawSetShadow(BaseBox[playerid], 0); TextDrawSetOutline(BaseBox[playerid], 0); TextDrawFont(BaseBox[playerid], 0);
TitleName[playerid] = TextDrawCreate(37.600002, 125.440002, "Los Santos Police Department And Me"); TextDrawLetterSize(TitleName[playerid], 0.274799, 1.771733); TextDrawTextSize(TitleName[playerid], 234.399978, -45.546684); TextDrawAlignment(TitleName[playerid], 1); TextDrawColor(TitleName[playerid], -1); TextDrawUseBox(TitleName[playerid], true); TextDrawBoxColor(TitleName[playerid], 5228678); TextDrawSetShadow(TitleName[playerid], 0); TextDrawSetOutline(TitleName[playerid], 1); TextDrawBackgroundColor(TitleName[playerid], 51); TextDrawFont(TitleName[playerid], 2); TextDrawSetProportional(TitleName[playerid], 1);
Informations[playerid] = TextDrawCreate(39.999996, 174.493331, "blah blah blah blah blah blahb laasdawrfaaw awrfaf taqwe fasr yuh awe a"); TextDrawLetterSize(Informations[playerid], 0.338799, 1.204266); TextDrawTextSize(Informations[playerid], 234.400085, 4.480000); TextDrawAlignment(Informations[playerid], 1); TextDrawColor(Informations[playerid], -1); TextDrawUseBox(Informations[playerid], true); TextDrawBoxColor(Informations[playerid], 0); TextDrawSetShadow(Informations[playerid], 0); TextDrawSetOutline(Informations[playerid], 1); TextDrawBackgroundColor(Informations[playerid], 51); TextDrawFont(Informations[playerid], 1); TextDrawSetProportional(Informations[playerid], 1);
ClosingText = TextDrawCreate(82.400001, 299.413360, "~y~Press ~w~(~r~LMB~w~) ~y~To Close"); TextDrawLetterSize(ClosingText, 0.281999, 1.525333); TextDrawAlignment(ClosingText, 1); TextDrawColor(ClosingText, -1); TextDrawSetShadow(ClosingText, 0); TextDrawSetOutline(ClosingText, 1); TextDrawBackgroundColor(ClosingText, 51); TextDrawFont(ClosingText, 1); TextDrawSetProportional(ClosingText, 1); }
return 1; }
stock ShowPlayerInfoBox(playerid , title[] , informations[] , TitleBoxColor = 0 , BaseBoxColor = 0) { TextDrawSetString(TitleName[playerid] , title); TextDrawSetString(Informations[playerid] , informations); if(TitleBoxColor != 0){TextDrawBoxColor(TitleName[playerid] , TitleBoxColor);} else { TextDrawBoxColor(TitleName[playerid], 5228678); } if(BaseBoxColor != 0){TextDrawBoxColor(BaseBox[playerid] , BaseBoxColor);} else { TextDrawBoxColor(BaseBox[playerid], 102); } InInfoBoxMode[playerid] = 1; TextDrawShowForPlayer(playerid , TitleName[playerid]); TextDrawShowForPlayer(playerid , Informations[playerid]); TextDrawShowForPlayer(playerid , BaseBox[playerid]); TextDrawShowForPlayer(playerid , ClosingText); return 1; }
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_FIRE ) { if(InInfoBoxMode[playerid] != 0) { InInfoBoxMode[playerid] = 0; TextDrawHideForPlayer(playerid , TitleName[playerid]); TextDrawHideForPlayer(playerid , Informations[playerid]); TextDrawHideForPlayer(playerid , BaseBox[playerid]); TextDrawHideForPlayer(playerid , ClosingText); } return 1; } #if defined KP_OnPlayerKeyStateChange KP_OnPlayerKeyStateChange(playerid, newkeys, oldkeys); #endif return 0; }
#if defined _ALS_OnPlayerKeyStateChange #undef OnPlayerKeyStateChange #else #define _ALS_OnPlayerKeyStateChange #endif
#define OnPlayerKeyStateChange KP_OnPlayerKeyStateChange
#if defined KP_OnPlayerKeyStateChange forward KP_OnPlayerKeyStateChange(playerid, newkeys, oldkeys); #endif
Когда нет знания, есть мнение.
|
|
|
|
Плисс |
Дата: Вторник, 19.07.2016, 21:06 | Сообщение # 2
|
Боец
Сообщений: 70
Статус: Offline
|
Christian_Chavez
|
|
|
|