PDA

Просмотр полной версии : [Вопрос] Маски / /mask



heralt
19.02.2015, 18:04
Вообщем решил сделать систему маски. Но доработать хочу.
1. На некоторых серверах, при активации команды в чате ник скрывается. (При общении ник становится "Неизвестный")
Подскажите функцию.
2. Подскажите обьект маски, я прикреплю его к лицу персонажа.


dcmd_mask(playerid, params[])
#pragma unused params
{
if(PlayerInfo[playerid][pRequestingBackup] == 1) return SendClientMessage(playerid,white,"У вас нет маски. Ее можно купить в 24/7");
{
new dialog[40];
format(dialog,sizeof(dialog),"Одеть маску\nСнять маску\nВыбросить маску");
ShowPlayerDialog(playerid,40,DIALOG_STYLE_LIST,"Маскировка",dialog,"Выбрать","Отмена");
return 1;
}
}


if(dialogid == 40)
{
switch(listitem)
{
case 0:SendClientMessage(playerid,white,"Ты одел маску"), SetPlayerColor(playerid,0x000000AA);
case 1:SendClientMessage(playerid,white,"Ты снял маску");
case 2:SendClientMessage(playerid,white,"Ты выбросил маску"), PlayerInfo[playerid][pRequestingBackup] = 0;
}

gangzone.ini
19.02.2015, 18:26
OnPlayerText:



if(GetPVarInt(playerid, "maska_odeta") == 1) format(string, sizeof(string),"{ffffff}%s {4F4F4F}Неизвестный", text);
SendClientMessage(playerid, 0x000000AA, string);




if(dialogid == 40)
{
switch(listitem)
{
case 0:
{
SendClientMessage(playerid,white,"Ты одел маску"), SetPlayerColor(playerid,0x000000AA);
SetPlayerAttachedObject(playerid, 0, 18915, 2, 0.1, 0.03, -0.005, 90.0, 180.0, 90.0);
GameTextForPlayer(playerid, "~g~INVISIBLE ON", 2000, 5);
SetPVarInt(playerid, "maska_odeta", 1);
}
case 1:
{
SendClientMessage(playerid,white,"Ты снял маску");
GameTextForPlayer(playerid, "~g~INVISIBLE OFF", 2000, 5);
SetPVarInt(playerid, "maska_odeta", 0);
}
case 2:SendClientMessage(playerid,white,"Ты выбросил маску"), PlayerInfo[playerid][pRequestingBackup] = 0;
}
}

heralt
19.02.2015, 18:38
Сейчас проверю. Такого быстрого ответа не ожидал )

gangzone.ini
19.02.2015, 18:41
Сейчас проверю. Такого быстрого ответа не ожидал )

Чу-чуть подправила, проверьте другой вариант в посте выше




if(GetPVarInt(playerid, "maska_odeta") == 1) format(string, sizeof(string),"{ffffff}%s {4F4F4F}Неизвестный", text);
SendClientMessage(playerid, 0x000000AA, string);


if(dialogid == 40)
{
switch(listitem)
{
case 0:
{
SendClientMessage(playerid,white,"Ты одел маску"), SetPlayerColor(playerid,0x000000AA);
SetPlayerAttachedObject(playerid, 0, 18915, 2, 0.1, 0.03, -0.005, 90.0, 180.0, 90.0);
GameTextForPlayer(playerid, "~g~INVISIBLE ON", 2000, 5);
SetPVarInt(playerid, "maska_odeta", 1);
}
case 1:
{
SendClientMessage(playerid,white,"Ты снял маску");
GameTextForPlayer(playerid, "~g~INVISIBLE OFF", 2000, 5);
SetPVarInt(playerid, "maska_odeta", 0);
}
case 2:SendClientMessage(playerid,white,"Ты выбросил маску"), PlayerInfo[playerid][pRequestingBackup] = 0;
}
}

heralt
19.02.2015, 19:02
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



Проверю в игре, отпишусь.

- - - Добавлено - - -

http://imgur.com/YvpPrvT


new nickvmaske[12];
if(GetPVarInt(playerid, "maska_odeta") == 1) format(nickvmaske, sizeof(nickvmaske),"Неизвестный", text); //{4F4F4F}

На счет команды, /mask - все хорошо работает.

gangzone.ini
19.02.2015, 19:27
if(GetPVarInt(playerid, "maska_odeta") == 1) format(nickvmaske, sizeof(nickvmaske),"Неизвестный", text); //{4F4F4F}
а где %s ? И почему nickvmaske 12 ? Если должно быть 78...
Максимальная длина текста в сампе = 64
Текст который уже есть: 2 пробела, "-", "Неизвестный" = 14



new nickvmaske[78];
if(GetPVarInt(playerid, "maska_odeta") == 1) format(nickvmaske, sizeof(nickvmaske),"%s - Неизвестный", text);

heralt
19.02.2015, 20:03
new nickvmaske[78];
if(GetPVarInt(playerid, "maska_odeta") == 1) format(nickvmaske, sizeof(nickvmaske),"Неизвестный: %s", text);
SendClientMessage(playerid, white, nickvmaske);

http://i.imgur.com/MkdjV3W.png

- - - Добавлено - - -

Если мы без маски, то с любой текст отображается с одной верхней пустой строкой.
Если мы в маске, то текст отображается с строкой "Неизвестный" и с строкой с ником "Ник"

gangzone.ini
19.02.2015, 20:05
Скиньте весь OnPlayerText

heralt
19.02.2015, 20:15
public OnPlayerText(playerid, text[])
{
new nickvmaske[78];
if(GetPVarInt(playerid, "maska_odeta") == 1) format(nickvmaske, sizeof(nickvmaske),"Неизвестный: %s", text);
SendClientMessage(playerid, white, nickvmaske);
SetPlayerChatBubble(playerid, text, white, 100.0, 10000);
if(GetPVarInt(playerid,"Logged") == 0)
{
SendClientMessage(playerid, red, "Ошибка: авторизуйся, что бы писать в чат.");
return 0;
}
return 1;
}

Mazzilla
19.02.2015, 20:41
if(GetPVarInt(playerid, "maska_odeta") == 1)
{
format(nickvmaske, sizeof(nickvmaske),"Неизвестный: %s", text);
SendClientMessage(playerid, white, nickvmaske);
}

gangzone.ini
19.02.2015, 20:45
public OnPlayerText(playerid, text[])
{
if(GetPVarInt(playerid,"Logged") == 0)
{
SendClientMessage(playerid, red, "Ошибка: авторизуйся, что бы писать в чат.");
return 0;
}
if(GetPVarInt(playerid, "maska_odeta"))
{
new nickvmaske[78];
if(GetPVarInt(playerid, "maska_odeta") == 1) format(nickvmaske, sizeof(nickvmaske),"Неизвестный: %s", text);
SendClientMessage(playerid, color_white, nickvmaske);
return 0;
}
return 1;
}

screen :smile: :

http://rghost.ru/8MVhr5JtK/image.png

heralt
19.02.2015, 21:04
if(GetPVarInt(playerid, "maska_odeta") == 1)
{
format(nickvmaske, sizeof(nickvmaske),"Неизвестный: %s", text);
SendClientMessage(playerid, white, nickvmaske);
}
1. Пустая строка пропала. (Без маски)
2. Если игрок в маске, его сообщение отображается в двух логах, с ником и с "неизвестный"

gangzone.ini
19.02.2015, 21:05
1. Пустая строка пропала. (Без маски)
2. Если игрок в маске, его сообщение отображается в двух логах, с ником и с "неизвестный"

Пост мой прочитайте :smile:




public OnPlayerText(playerid, text[])
{
if(GetPVarInt(playerid,"Logged") == 0)
{
SendClientMessage(playerid, red, "Ошибка: авторизуйся, что бы писать в чат.");
return 0;
}
if(GetPVarInt(playerid, "maska_odeta"))
{
new nickvmaske[78];
if(GetPVarInt(playerid, "maska_odeta") == 1) format(nickvmaske, sizeof(nickvmaske),"Неизвестный: %s", text);
SendClientMessage(playerid, color_white, nickvmaske);
return 0;
}
return 1;
}



2. Если игрок в маске, его сообщение отображается в двух логах, с ником и с "неизвестный"
Потому что не хватает "return 0", либо "return false"

heralt
19.02.2015, 21:21
eeee. Проблема решена. Теперь буду пихать это чудо в команды )

I'm Cobra
20.02.2015, 22:02
Вместо PVar'ов добавьте
new bool:maska_odeta[MAX_PLAYERS];

L0ndl3m
20.02.2015, 22:24
Пользы от этих "bool" нет, ибо всё равно 4 байта занимает ячейка массива.