SA-MP Forums Archive
[AJUDA] Chat VIP. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA] Chat VIP. (/showthread.php?tid=253258)



[AJUDA] Chat VIP. - CaSSCaT - 05.05.2011

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.


Re: [AJUDA] Chat VIP. - Macintosh - 05.05.2011

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;
    }



Re: [AJUDA] Chat VIP. - Shadoww5 - 05.05.2011

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


Re: [AJUDA] Chat VIP. - CaSSCaT - 05.05.2011

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


Re: [AJUDA] Chat VIP. - Josma_cmd - 05.05.2011

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.


Re: [AJUDA] Chat VIP. - Shadoww5 - 05.05.2011

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".


Re: [AJUDA] Chat VIP. - CaSSCaT - 05.05.2011

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"



Re: [AJUDA] Chat VIP. - Macintosh - 05.05.2011

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.


Re: [AJUDA] Chat VIP. - CaSSCaT - 05.05.2011

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"



Re: [AJUDA] Chat VIP. - CaSSCaT - 05.05.2011

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.