[AJUDA] Chat VIP.
#1

Estou com um GM RPG ne ta tudo certinho so pq eu to querendo colocar um chat vip pois no meu GM nao tem.
alguem poderia me ajudar a fazer um ou postar um aqui?


Agradeзo des de ja.
Reply
#2

pawn Код:
new sendername[MAX_PLAYER_NAME];
pawn Код:
forward SendVIPMessage(color, string[]);
public SendVIPMessage(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pVIP] >= 1)
            {
                SendClientMessage(i, color, string);
            }
        }
    }
}
pawn Код:
if(strcmp(cmd, "/cvip", true) == 0 || strcmp(cmd, "/v", true) == 0)
    {
        if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pVIP] >= 1)
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            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, "USE: /v [Chat Vip]");
                return 1;
            }
            format(string, sizeof(string), "** VIP %s: %s", sendername, result);
            SendVIPMessage(0xFFCCFFAA,string);
            printf("VIP %s: %s", sendername, result);
        }
        return 1;
    }
Reply
#3

pawn Код:
forward MandarMensagemVIP(color, string[])
public MandarMensagemVIP(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
                    if(PlayerInfo[i][pDonateRank] > 0)
                {
                SendClientMessage(i,color, string);
            }
        }
    }
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/vip", true) == 0)
    {
        if(IsPlayerConnected(playerid))
            {
            new sendername[MAX_PLAYER_NAME];
            GetPlayerName(playerid, sendername, sizeof(sendername));
            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, 0xBFC0C2FF, "USO: /vp [texto]");
                return 1;
            }
            else if(PlayerInfo[playerid][pDonateRank] > 0)
            {
                format(string, sizeof(string), "Jogador VIP %s: %s ** ", sendername, result);
                SendVIPMessage(0xBA55D3FF, string);
                return 1;
            }
            else return SendClientMessage(playerid, 0xFFFF00AA, "   Vocк nгo й VIP !");
        }
        else return SendClientMessage(playerid, 0xFFFF00AA, "   Vocк deve fazer login para usar o radio !");
    }
    return 1;
}
@EDIT

kkkkkk, qq isso shickcard. Eu tava fazendo o codigo e quando postei o seu ja tava la ... kkk
Reply
#4

Shickcard Gostei do seu chat tipo mais vc poderia me explicar onde eu coloco cada code desse?
Reply
#5

No inicio do GM ou no inicio do comando
pawn Код:
new sendername[MAX_PLAYER_NAME];
pode ser no fim do GM ou em baixo de alguma public
pawn Код:
forward SendVIPMessage(color, string[]);
public SendVIPMessage(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pVIP] >= 1)
            {
                SendClientMessage(i, color, string);
            }
        }
    }
}
No OnPlayerCommandText
pawn Код:
if(strcmp(cmd, "/cvip", true) == 0 || strcmp(cmd, "/v", true) == 0)
    {
        if(PlayerInfo[playerid][pVIP] >= 1)
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            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, "USE: /v [Chat Vip]");
                return 1;
            }
            format(string, sizeof(string), "** VIP %s: %s", sendername, result);
            SendVIPMessage(0xFFCCFFAA,string);
            printf("VIP %s: %s", sendername, result);
        }
        return 1;
    }
IsPlayerConnected(playerid) nгo й necessбrio.
Reply
#6

A public vocк pode colocar em qualquer lugar e o forward vocк coloca no inicio do GM.

Ja o comando vocк deve colocar lб naquela public chamada de "OnPlayerCommandText".
Reply
#7

Eu acho que fiz tudo certinho mais olha os erros que deu!

pawn Код:
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(4151) : warning 219: local variable "sendername" shadows a variable at a preceding level
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(18744) : warning 219: local variable "sendername" shadows a variable at a preceding level
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(18828) : error 017: undefined symbol "pVIP"
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(43201) : warning 219: local variable "sendername" shadows a variable at a preceding level
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(48333) : error 021: symbol already defined: "SendVIPMessage"
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(48338) : error 017: undefined symbol "pVIP"
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(48345) : warning 203: symbol is never used: "sendername"
Reply
#8

Quote:
Originally Posted by CaSSCaT
Посмотреть сообщение
Eu acho que fiz tudo certinho mais olha os erros que deu!

pawn Код:
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(4151) : warning 219: local variable "sendername" shadows a variable at a preceding level
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(18744) : warning 219: local variable "sendername" shadows a variable at a preceding level
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(18828) : error 017: undefined symbol "pVIP"
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(43201) : warning 219: local variable "sendername" shadows a variable at a preceding level
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(48333) : error 021: symbol already defined: "SendVIPMessage"
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(48338) : error 017: undefined symbol "pVIP"
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(48345) : warning 203: symbol is never used: "sendername"
Mude pVIP para a define dos VIP's em seu GM.
Reply
#9

nao consegui encontrar a define dos vips no meu gm +.+

@EDIT

Sera que й [pDonateRank] ?

@EDITІ

й sim e pDonateRank agora so falta um erro.

pawn Код:
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(48333) : error 021: symbol already defined: "SendVIPMessage"
Reply
#10

Quote:
Originally Posted by CaSSCaT
Посмотреть сообщение
pawn Код:
D:\Cбssio\Game Modes SA-MP\TrueLife RPG (Na 0.3c)\gamemodes\BTL.pwn(48333) : error 021: symbol already defined: "SendVIPMessage"
Conseguir arrumar

so troquei o "SendVIPMessage" por "SendDonateRankMessage" ai funfo.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)