debeloner
Новичок
Всем привет, от скуки накидал систему потребностей на текстдравах.
На оценочку.
Скриншотик:На оценочку.
Чтобы видеть скрытое содержание Зарегистрируйтесь на форуме!
Pawn:
// к остальным енамам
enum e_pInfo
{
pSleep,
pGolod,
pNeed,
pName,
}
new pInfo[MAX_PLAYERS][e_pInfo];
//[Переменные]
new Text:PublicTD[7];
new PlayerText:PlayerTD[MAX_PLAYERS][7];
// OnGameModeInit
LoadGlobalTextdraw();
// OnPlayerConnect
LoadPlayerTextdraw(playerid);
SetPVarInt(playerid, "OpenNeeds", 0);
// OnPlayerKeyStateChange
if(newkeys == 65536)
{
if(GetPVarInt(playerid, "OpenNeeds") == 0)
{
ShowNeeds(playerid);
SetPVarInt(playerid, "OpenNeeds", 1);
}
else
{
HideNeed(playerid);
SetPVarInt(playerid, "OpenNeeds", 0);
}
}
Код:
stock LoadGlobalTextdraw()
{
PublicTD[0] = TextDrawCreate(160.000000, 114.000000, "LD_SPAC:white");
TextDrawFont(PublicTD[0], 4);
TextDrawLetterSize(PublicTD[0], 0.600000, 2.000000);
TextDrawTextSize(PublicTD[0], 320.500000, 129.500000);
TextDrawSetOutline(PublicTD[0], 1);
TextDrawSetShadow(PublicTD[0], 0);
TextDrawAlignment(PublicTD[0], 1);
TextDrawColor(PublicTD[0], 67);
TextDrawBackgroundColor(PublicTD[0], 255);
TextDrawBoxColor(PublicTD[0], 50);
TextDrawUseBox(PublicTD[0], 1);
TextDrawSetProportional(PublicTD[0], 1);
TextDrawSetSelectable(PublicTD[0], 0);
PublicTD[1] = TextDrawCreate(276.000000, 138.000000, "LD_SPAC:white");
TextDrawFont(PublicTD[1], 4);
TextDrawLetterSize(PublicTD[1], 0.600000, 2.000000);
TextDrawTextSize(PublicTD[1], 173.000000, 22.500000);
TextDrawSetOutline(PublicTD[1], 1);
TextDrawSetShadow(PublicTD[1], 0);
TextDrawAlignment(PublicTD[1], 1);
TextDrawColor(PublicTD[1], 1296911696);
TextDrawBackgroundColor(PublicTD[1], 0);
TextDrawBoxColor(PublicTD[1], 50);
TextDrawUseBox(PublicTD[1], 1);
TextDrawSetProportional(PublicTD[1], 1);
TextDrawSetSelectable(PublicTD[1], 0);
PublicTD[2] = TextDrawCreate(283.000000, 128.000000, "сон");
TextDrawFont(PublicTD[2], 2);
TextDrawLetterSize(PublicTD[2], 0.279166, 1.050000);
TextDrawTextSize(PublicTD[2], 400.000000, 17.000000);
TextDrawSetOutline(PublicTD[2], 1);
TextDrawSetShadow(PublicTD[2], 0);
TextDrawAlignment(PublicTD[2], 1);
TextDrawColor(PublicTD[2], -1);
TextDrawBackgroundColor(PublicTD[2], 0);
TextDrawBoxColor(PublicTD[2], 50);
TextDrawUseBox(PublicTD[2], 0);
TextDrawSetProportional(PublicTD[2], 1);
TextDrawSetSelectable(PublicTD[2], 0);
PublicTD[3] = TextDrawCreate(276.000000, 169.000000, "LD_SPAC:white");
TextDrawFont(PublicTD[3], 4);
TextDrawLetterSize(PublicTD[3], 0.600000, 2.000000);
TextDrawTextSize(PublicTD[3], 173.000000, 22.500000);
TextDrawSetOutline(PublicTD[3], 1);
TextDrawSetShadow(PublicTD[3], 0);
TextDrawAlignment(PublicTD[3], 1);
TextDrawColor(PublicTD[3], 1296911696);
TextDrawBackgroundColor(PublicTD[3], 0);
TextDrawBoxColor(PublicTD[3], 50);
TextDrawUseBox(PublicTD[3], 1);
TextDrawSetProportional(PublicTD[3], 1);
TextDrawSetSelectable(PublicTD[3], 0);
PublicTD[4] = TextDrawCreate(283.000000, 160.000000, "голод");
TextDrawFont(PublicTD[4], 2);
TextDrawLetterSize(PublicTD[4], 0.279166, 1.050000);
TextDrawTextSize(PublicTD[4], 400.000000, 17.000000);
TextDrawSetOutline(PublicTD[4], 1);
TextDrawSetShadow(PublicTD[4], 0);
TextDrawAlignment(PublicTD[4], 1);
TextDrawColor(PublicTD[4], -1);
TextDrawBackgroundColor(PublicTD[4], 0);
TextDrawBoxColor(PublicTD[4], 50);
TextDrawUseBox(PublicTD[4], 0);
TextDrawSetProportional(PublicTD[4], 1);
TextDrawSetSelectable(PublicTD[4], 0);
PublicTD[5] = TextDrawCreate(283.000000, 191.000000, "нужда");
TextDrawFont(PublicTD[5], 2);
TextDrawLetterSize(PublicTD[5], 0.279166, 1.050000);
TextDrawTextSize(PublicTD[5], 400.000000, 17.000000);
TextDrawSetOutline(PublicTD[5], 1);
TextDrawSetShadow(PublicTD[5], 0);
TextDrawAlignment(PublicTD[5], 1);
TextDrawColor(PublicTD[5], -1);
TextDrawBackgroundColor(PublicTD[5], 0);
TextDrawBoxColor(PublicTD[5], 50);
TextDrawUseBox(PublicTD[5], 0);
TextDrawSetProportional(PublicTD[5], 1);
TextDrawSetSelectable(PublicTD[5], 0);
PublicTD[6] = TextDrawCreate(276.000000, 199.300003, "LD_SPAC:white");
TextDrawFont(PublicTD[6], 4);
TextDrawLetterSize(PublicTD[6], 0.600000, 2.000000);
TextDrawTextSize(PublicTD[6], 173.000000, 22.500000);
TextDrawSetOutline(PublicTD[6], 1);
TextDrawSetShadow(PublicTD[6], 0);
TextDrawAlignment(PublicTD[6], 1);
TextDrawColor(PublicTD[6], 1296911696);
TextDrawBackgroundColor(PublicTD[6], 0);
TextDrawBoxColor(PublicTD[6], 50);
TextDrawUseBox(PublicTD[6], 1);
TextDrawSetProportional(PublicTD[6], 1);
TextDrawSetSelectable(PublicTD[6], 0);
}
stock LoadPlayerTextdraw(playerid){
PlayerTD[playerid][0] = CreatePlayerTextDraw(playerid, 155.000000, 115.000000, "TextDraw");
PlayerTextDrawFont(playerid, PlayerTD[playerid][0], 5);
PlayerTextDrawLetterSize(playerid, PlayerTD[playerid][0], 0.600000, 2.000000);
PlayerTextDrawTextSize(playerid, PlayerTD[playerid][0], 126.500000, 129.000000);
PlayerTextDrawSetOutline(playerid, PlayerTD[playerid][0], 1);
PlayerTextDrawSetShadow(playerid, PlayerTD[playerid][0], 0);
PlayerTextDrawAlignment(playerid, PlayerTD[playerid][0], 1);
PlayerTextDrawColor(playerid, PlayerTD[playerid][0], -1);
PlayerTextDrawBackgroundColor(playerid, PlayerTD[playerid][0], 0);
PlayerTextDrawBoxColor(playerid, PlayerTD[playerid][0], 50);
PlayerTextDrawUseBox(playerid, PlayerTD[playerid][0], 1);
PlayerTextDrawSetProportional(playerid, PlayerTD[playerid][0], 1);
PlayerTextDrawSetSelectable(playerid, PlayerTD[playerid][0], 0);
PlayerTextDrawSetPreviewModel(playerid, PlayerTD[playerid][0], 0);
PlayerTextDrawSetPreviewRot(playerid, PlayerTD[playerid][0], -17.000000, 0.000000, 28.000000, 1.000000);
PlayerTextDrawSetPreviewVehCol(playerid, PlayerTD[playerid][0], 1, 1);
PlayerTD[playerid][1] = CreatePlayerTextDraw(playerid, 277.000000, 139.000000, "LD_SPAC:white");
PlayerTextDrawFont(playerid, PlayerTD[playerid][1], 4);
PlayerTextDrawLetterSize(playerid, PlayerTD[playerid][1], 0.600000, 2.000000);
PlayerTextDrawTextSize(playerid, PlayerTD[playerid][1], 0, 20.000000); // 170.5 20.0
PlayerTextDrawSetOutline(playerid, PlayerTD[playerid][1], 1);
PlayerTextDrawSetShadow(playerid, PlayerTD[playerid][1], 0);
PlayerTextDrawAlignment(playerid, PlayerTD[playerid][1], 1);
PlayerTextDrawColor(playerid, PlayerTD[playerid][1], 2094989255);
PlayerTextDrawBackgroundColor(playerid, PlayerTD[playerid][1], 0);
PlayerTextDrawBoxColor(playerid, PlayerTD[playerid][1], 50);
PlayerTextDrawUseBox(playerid, PlayerTD[playerid][1], 1);
PlayerTextDrawSetProportional(playerid, PlayerTD[playerid][1], 1);
PlayerTextDrawSetSelectable(playerid, PlayerTD[playerid][1], 0);
PlayerTD[playerid][2] = CreatePlayerTextDraw(playerid, 422.000000, 128.000000, "-1");
PlayerTextDrawFont(playerid, PlayerTD[playerid][2], 1);
PlayerTextDrawLetterSize(playerid, PlayerTD[playerid][2], 0.279166, 1.050000);
PlayerTextDrawTextSize(playerid, PlayerTD[playerid][2], 400.000000, 17.000000);
PlayerTextDrawSetOutline(playerid, PlayerTD[playerid][2], 1);
PlayerTextDrawSetShadow(playerid, PlayerTD[playerid][2], 0);
PlayerTextDrawAlignment(playerid, PlayerTD[playerid][2], 1);
PlayerTextDrawColor(playerid, PlayerTD[playerid][2], -1);
PlayerTextDrawBackgroundColor(playerid, PlayerTD[playerid][2], 0);
PlayerTextDrawBoxColor(playerid, PlayerTD[playerid][2], 50);
PlayerTextDrawUseBox(playerid, PlayerTD[playerid][2], 0);
PlayerTextDrawSetProportional(playerid, PlayerTD[playerid][2], 1);
PlayerTextDrawSetSelectable(playerid, PlayerTD[playerid][2], 0);
PlayerTD[playerid][3] = CreatePlayerTextDraw(playerid, 277.000000, 170.300003, "LD_SPAC:white");
PlayerTextDrawFont(playerid, PlayerTD[playerid][3], 4);
PlayerTextDrawLetterSize(playerid, PlayerTD[playerid][3], 0.600000, 2.000000);
PlayerTextDrawTextSize(playerid, PlayerTD[playerid][3], 0, 20.000000); // 170.5 20.0
PlayerTextDrawSetOutline(playerid, PlayerTD[playerid][3], 1);
PlayerTextDrawSetShadow(playerid, PlayerTD[playerid][3], 0);
PlayerTextDrawAlignment(playerid, PlayerTD[playerid][3], 1);
PlayerTextDrawColor(playerid, PlayerTD[playerid][3], 2012118477);
PlayerTextDrawBackgroundColor(playerid, PlayerTD[playerid][3], 0);
PlayerTextDrawBoxColor(playerid, PlayerTD[playerid][3], 50);
PlayerTextDrawUseBox(playerid, PlayerTD[playerid][3], 1);
PlayerTextDrawSetProportional(playerid, PlayerTD[playerid][3], 1);
PlayerTextDrawSetSelectable(playerid, PlayerTD[playerid][3], 0);
PlayerTD[playerid][4] = CreatePlayerTextDraw(playerid, 422.000000, 160.000000, "-1");
PlayerTextDrawFont(playerid, PlayerTD[playerid][4], 1);
PlayerTextDrawLetterSize(playerid, PlayerTD[playerid][4], 0.279166, 1.050000);
PlayerTextDrawTextSize(playerid, PlayerTD[playerid][4], 400.000000, 17.000000);
PlayerTextDrawSetOutline(playerid, PlayerTD[playerid][4], 1);
PlayerTextDrawSetShadow(playerid, PlayerTD[playerid][4], 0);
PlayerTextDrawAlignment(playerid, PlayerTD[playerid][4], 1);
PlayerTextDrawColor(playerid, PlayerTD[playerid][4], -1);
PlayerTextDrawBackgroundColor(playerid, PlayerTD[playerid][4], 0);
PlayerTextDrawBoxColor(playerid, PlayerTD[playerid][4], 50);
PlayerTextDrawUseBox(playerid, PlayerTD[playerid][4], 0);
PlayerTextDrawSetProportional(playerid, PlayerTD[playerid][4], 1);
PlayerTextDrawSetSelectable(playerid, PlayerTD[playerid][4], 0);
PlayerTD[playerid][5] = CreatePlayerTextDraw(playerid, 277.000000, 200.500000, "LD_SPAC:white");
PlayerTextDrawFont(playerid, PlayerTD[playerid][5], 4);
PlayerTextDrawLetterSize(playerid, PlayerTD[playerid][5], 0.600000, 2.000000);
PlayerTextDrawTextSize(playerid, PlayerTD[playerid][5], 0, 20.000000); // 170.5 20.0
PlayerTextDrawSetOutline(playerid, PlayerTD[playerid][5], 1);
PlayerTextDrawSetShadow(playerid, PlayerTD[playerid][5], 0);
PlayerTextDrawAlignment(playerid, PlayerTD[playerid][5], 1);
PlayerTextDrawColor(playerid, PlayerTD[playerid][5], -184589848);
PlayerTextDrawBackgroundColor(playerid, PlayerTD[playerid][5], 0);
PlayerTextDrawBoxColor(playerid, PlayerTD[playerid][5], 50);
PlayerTextDrawUseBox(playerid, PlayerTD[playerid][5], 1);
PlayerTextDrawSetProportional(playerid, PlayerTD[playerid][5], 1);
PlayerTextDrawSetSelectable(playerid, PlayerTD[playerid][5], 0);
PlayerTD[playerid][6] = CreatePlayerTextDraw(playerid, 422.000000, 191.000000, "-1");
PlayerTextDrawFont(playerid, PlayerTD[playerid][6], 1);
PlayerTextDrawLetterSize(playerid, PlayerTD[playerid][6], 0.279166, 1.050000);
PlayerTextDrawTextSize(playerid, PlayerTD[playerid][6], 400.000000, 17.000000);
PlayerTextDrawSetOutline(playerid, PlayerTD[playerid][6], 1);
PlayerTextDrawSetShadow(playerid, PlayerTD[playerid][6], 0);
PlayerTextDrawAlignment(playerid, PlayerTD[playerid][6], 1);
PlayerTextDrawColor(playerid, PlayerTD[playerid][6], -1);
PlayerTextDrawBackgroundColor(playerid, PlayerTD[playerid][6], 0);
PlayerTextDrawBoxColor(playerid, PlayerTD[playerid][6], 50);
PlayerTextDrawUseBox(playerid, PlayerTD[playerid][6], 0);
PlayerTextDrawSetProportional(playerid, PlayerTD[playerid][6], 1);
PlayerTextDrawSetSelectable(playerid, PlayerTD[playerid][6], 0);
}
stock ShowNeeds(playerid)
{
UpdateNeeds(playerid);
for(new i; i<7; i++)
{
TextDrawShowForPlayer(playerid, PublicTD[i]);
PlayerTextDrawShow(playerid, PlayerTD[playerid][i]);
}
}
stock HideNeed(playerid)
{
for(new i; i<7; i++)
{
TextDrawHideForPlayer(playerid, PublicTD[i]);
PlayerTextDrawHide(playerid, PlayerTD[playerid][i]);
}
}
stock UpdateNeeds(playerid)
{
new str[128];
new skin = GetPlayerSkin(playerid);
PlayerTextDrawSetPreviewModel(playerid, PlayerTD[playerid][0], skin);
PlayerTextDrawTextSize(playerid, PlayerTD[playerid][1], pInfo[playerid][pSleep]*1.705, 20.0000);
format(str, sizeof(str), "%d/100", pInfo[playerid][pSleep]);
PlayerTextDrawSetString(playerid, PlayerTD[playerid][2], str);
PlayerTextDrawTextSize(playerid, PlayerTD[playerid][3], pInfo[playerid][pGolod]*1.705, 20.0000);
format(str, sizeof(str), "%d/100", pInfo[playerid][pGolod]);
PlayerTextDrawSetString(playerid, PlayerTD[playerid][4], str);
PlayerTextDrawTextSize(playerid, PlayerTD[playerid][5], pInfo[playerid][pNeed]*1.705, 20.0000);
format(str, sizeof(str), "%d/100", pInfo[playerid][pNeed]);
PlayerTextDrawSetString(playerid, PlayerTD[playerid][6], str);
return true;
}
Код:
CMD:setneed(playerid, params[])
{
new value, id, tneed;
if(sscanf(params, "iii", tneed, id, value))
{
SendClientMessage(playerid, -1, "/setneed [1 - сон/2 - голод/3 - нужда] [id] [value]");
}
if(value > 100 || value < 0) SendClientMessage(playerid, -1, "Вы не можете установить значение больше 100");
switch(tneed)
{
case 1: pInfo[id][pSleep] = value;
case 2: pInfo[id][pGolod] = value;
case 3: pInfo[id][pNeed] = value;
}
}
Последнее редактирование модератором:
