faraday.
Эксперт
Немного переделал, теперь под большое количество постов с удобным добавлением.
Не нужно вводить КМД, просто встать на пост и 3д текст изменится ну и в диалоге /post будет видно кто стоит.
Единственное что, надо проверки на армейца вставить
в OnGameModeInit
в EnterDynamicArea
в LeaveDynamicArea
в OnPlayerDisconnect
Команда просмотра:
Не нужно вводить КМД, просто встать на пост и 3д текст изменится ну и в диалоге /post будет видно кто стоит.
Единственное что, надо проверки на армейца вставить
PHP:
#define max_posts 2
enum Post
{
Float:post_x,
Float:post_y,
Float:post_z,
name[24],
area,
Text3D:post3D,
player,
}
new Float:post_info[max_posts][Post] =
{
{107.4416,1900.1370,33.4979,"Вышка №1"}, //
{98.8171,1924.0579,18.2171,"КПП №1"} // ниже добавляйте свои
};
PHP:
for(new i; i<max_posts; i++)
{
//присвоим отвечающей за playerid - невалидный ид
post_info[i][player] = INVALID_PLAYER_ID;
//создадим зону
post_info[i][area] = CreateDynamicCircle(post_info[i][post_x],post_info[i][post_y], 1.0 , 0, 0, -1);
//создаем 3д тексты постов
new string[52];
format(string, sizeof string, "Пост: {ffd400}%s\n{76c422}Свободен", post_info[i][name]);
post_info[i][post3D] = CreateDynamic3DTextLabel(string,-1,post_info[i][post_x],post_info[i][post_y],post_info[i][post_z],25.0,INVALID_PLAYER_ID,INVALID_PLAYER_ID,0,0,0,-1,100.0);
}
в EnterDynamicArea
PHP:
// тут проверка на армейца { }
for(new i; i<max_posts; i++)
{
if(areaid == post_info[i][area] && post_info[i][player] == INVALID_PLAYER_ID)
{
new string[15+24+24], named[MAX_PLAYER_NAME];
post_info[i][player] = playerid;
GetPlayerName(post_info[i][player], named, 24);
format(string, sizeof string, "Пост: {ffd400}%s\n{76c422}%s", post_info[i][name], named);
UpdateDynamic3DTextLabelText(post_info[i][post3D], -1, string);
SetPVarInt(playerid, "post", i);
}
}
PHP:
for(new i; i<max_posts; i++)
{
if(areaid == post_info[i][area] && post_info[i][player] == playerid)
{
new string[18+24];
format(string, sizeof string, "Пост: {ffd400}%s\n{76c422}Свободен", post_info[i][name]);
UpdateDynamic3DTextLabelText(post_info[i][post3D], -1, string);
post_info[i][player] = INVALID_PLAYER_ID;
DeletePVar(playerid, "post");
}
}
PHP:
if(GetPVarInt(playerid, "post") != -1)
{
new string[18+24];
format(string, sizeof string, "Пост: {ffd400}%s\n{76c422}Свободен", post_info[GetPVarInt(playerid, "post")][name]);
UpdateDynamic3DTextLabelText(post_info[GetPVarInt(playerid, "post")][post3D], -1, string);
post_info[GetPVarInt(playerid, "post")][player] = INVALID_PLAYER_ID;
DeletePVar(playerid, "post");
}
PHP:
CMD:post(playerid)
{
new string[256],named[MAX_PLAYER_NAME];
for(new i; i<max_posts; i++)
{
if(post_info[i][player] != INVALID_PLAYER_ID)
{
GetPlayerName(post_info[i][player], named, 24);
format(string, sizeof string, "%s{ffffff}Пост: %s\t{76c422}%s\n", string, post_info[i][name],named);
}
else format(string, sizeof string, "%s{ffffff}Пост: %s\t{76c422}Свободен\n", string, post_info[i][name]);
}
ShowPlayerDialog(playerid, 0000, DIALOG_STYLE_TABLIST, "{ffffff}Посты:", string, "Принять","Закрыть");
}
Последнее редактирование: