музыка mp3 и мобильные телефонысофт портал
Обновить страницу!

 



 
          





Реклама
Проэктов




  • Страница 1 из 1
  • 1
[Урок] Read Pm - читать личные сообщение
У вас  Дата: Четверг, 29.12.2011, 01:14 | Сообщение # 1

_MaRiK_







         Пол:Мужчина
         Сообщений: 42
         Репутация: 777
создаем форвард:
Код:


forward SendPmMessage(color, string[]);

ко всем "new"

new ReadPm[MAX_PLAYERS];

затем сам паблик:

public SendPmMessage(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(ReadPm[i] ==1)
{
SendClientMessage(i, color, string);
}
}
}
}


в паблик OnPlayerConnect

ReadPm[playerid] = 0;

Затем в паблик OnPlayerCommandText

if(strcmp(cmd, "/readpm", true) == 0 && PlayerInfo[playerid][pAdmin] >= 2)
{
if(IsPlayerConnected(playerid))
{
if (!ReadPm[playerid])
{
ReadPm[playerid] = 1;
SendClientMessage(playerid, COLOR_GRAD2, " Вы читаете ЛС");
}
else if (ReadPm[playerid])
{
(ReadPm[playerid] = 0);
SendClientMessage(playerid, COLOR_GRAD2, " Вы больше не читаете ЛС");
}
}
return 1;
}

и дальше вставляем в вашу команду /pm или /wisper можно и в диалоги вставить если личка на диалогах

if(strcmp(cmd, "/wisper", true) == 0 || strcmp(cmd, "/w", true) == 0)
{
for(new i=0; i<MAX_PLAYERS; i++)
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " Сначала залогинься ! ");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, " *Используй /w [id] текст ");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(HidePM[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Игрок заблокировал ЛС ! ");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(ChatSpamStrings[playerid] >= MAX_CHAT_SPAM) {SendClientMessage(playerid, COLOR_BRIGHTRED, " Превышен лимит сообщений.");return 1;}
ChatSpamStrings[playerid] ++;
if(giveplayerid == playerid)
{
format(string, sizeof(string), " * %s разговаривает сам с собой. ", sendername);
ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Используй: (/w)isper [id [текст]");
return 1;
}
format(string, sizeof(string), " *Лс от %s(ID: %d) : %s ", sendername, playerid, (result));
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string, sizeof(string), " *Лс доставлено %s(ID: %d): %s .", giveplayer, giveplayerid, (result));
SendClientMessage(playerid, COLOR_YELLOW, string);
SBizzInfo[2][sbTill] += txtcost / 2;
ExtortionSBiz(2, txtcost / 2);
OnPropUpdate();
[COLOR="#ff0000"]format(string, sizeof(string), " *ЛС от %s к %s(ID: %d): %s .",sendername, giveplayer, giveplayerid, (result));
SendPmMessage(COLOR_LIGHTRED, string);

return 1;
}
}
else
{
format(string, sizeof(string), " %d не активный. ", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
 
  • Страница 1 из 1
  • 1
Поиск:





 


 


 
Pawno-Info © 2011