[Ajuda] Preciso de ajuda pra criar um xat interno entra as orgs
#1

Seguinte no meu GM tem 2 ORGS ai eu queria fazer um chat interno entre elas. EX: Eu escolhi jogar com os policiais ai eu falo assim /r Eae, ai essa mensagem "Eae" sу vai para os policiais que estгo online. Se alguem puder me ajudar irei agradeзer muito xD
Reply
#2

manda o cуdigo que verifica se o player й policial.. exemplo: PlayerInfo[playerid][pPolicia]
Reply
#3

Ta ae й so isso porque meu GM nгo й de RPG

pawn Code:
#define policias                                                                2
Reply
#4

vou tomar banho jб dou um edit aki em baixo

@edit
manda o dos ladrхes tbm
#define policias 2
e tem o #define ladroes 1 ?

vou ver american pie 7 .-.
Reply
#5

pawn Code:
#define corredores 1
Reply
#6

pawn Code:
#include <sscanf2>
new Gang[MAX_PLAYERS];
quando o player escolher corredores vocк coloca Gang[playerid] = 1; quando for policiais coloca Gang[playerid] = 2; (tente pesquisar por corredores e adicione Gang[playerid] = 1 junto ao cуdigo...)

agora o chat:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new params[100 char];
    new msg[128];
    unformat(cmdtext, "s[50]S( )[100]",cmd,params);
   
    if(strcmp(cmd, "/chat", true) == 0)
    {
        new msg2[100];
        if(sscanf(params, "s[100]", msg2)) return SendClientMessage(playerid, -1, "USO: /chat [mensagem]");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(Gang[playerid] == 1)
            {
                if(Gang[i] == 1)
                {
                    format(msg, sizeof(msg), "|CHAT| %s diz: %s", Name(playerid), msg2);
                    SendClientMessage(i, -1, msg);
                }
            }
            else if(Gang[playerid] == 2)
            {
                if(Gang[i] == 2)
                {
                    format(msg, sizeof(msg), "|CHAT| %s diz: %s", Name(playerid), msg2);
                    SendClientMessage(i, -1, msg);
                }
            }
        }
        return 1;
    }
    return 0;
}
pawn Code:
Name(playerid)// coloca isso no final do GM/FS
{
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof(nome));
    return nome;
}
Reply
#7

Quote:
Originally Posted by Cristhian
View Post
pawn Code:
#include <sscanf2>
new Gang[MAX_PLAYERS];
quando o player escolher corredores vocк coloca Gang[playerid] = 1; quando for policiais coloca Gang[playerid] = 2; (tente pesquisar por corredores e adicione Gang[playerid] = 1 junto ao cуdigo...)

agora o chat:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new params[100 char];
    new msg[128];
    unformat(cmdtext, "s[50]S( )[100]",cmd,params);
   
    if(strcmp(cmd, "/chat", true) == 0)
    {
        new msg2[100];
        if(sscanf(params, "s[100]", msg2)) return SendClientMessage(playerid, -1, "USO: /chat [mensagem]");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(Gang[playerid] == 1)
            {
                if(Gang[i] == 1)
                {
                    format(msg, sizeof(msg), "|CHAT| %s diz: %s", Name(playerid), msg2);
                    SendClientMessage(i, -1, msg);
                }
            }
            else if(Gang[playerid] == 2)
            {
                if(Gang[i] == 2)
                {
                    format(msg, sizeof(msg), "|CHAT| %s diz: %s", Name(playerid), msg2);
                    SendClientMessage(i, -1, msg);
                }
            }
        }
        return 1;
    }
    return 0;
}
pawn Code:
Name(playerid)// coloca isso no final do GM/FS
{
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof(nome));
    return nome;
}
Seria legal vocк usar return para nгo ocasionar nenhum bug (:
Reply
#8

Quote:
Originally Posted by Macintosh
View Post
Seria legal vocк usar return para nгo ocasionar nenhum bug (:
return onde ?
Reply
#9

Quote:
Originally Posted by Cristhian
View Post
return onde ?
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new params[100 char];
    new msg[128];
    unformat(cmdtext, "s[50]S( )[100]",cmd,params);
   
    if(strcmp(cmd, "/chat", true) == 0)
    {
        new msg2[100];
        if(sscanf(params, "s[100]", msg2)) return SendClientMessage(playerid, -1, "USO: /chat [mensagem]");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(Gang[playerid] == 1)
            {
                if(Gang[i] == 1)
                {
                    format(msg, sizeof(msg), "|CHAT| %s diz: %s", Name(playerid), msg2);
                    SendClientMessage(i, -1, msg);
                    return 1;
                }
                return 1;
            }
            else if(Gang[playerid] == 2)
            {
                if(Gang[i] == 2)
                {
                    format(msg, sizeof(msg), "|CHAT| %s diz: %s", Name(playerid), msg2);
                    SendClientMessage(i, -1, msg);
                    return 1;
                }
                return 1;
            }
        }
        return 1;
    }
    return 0;
}
Reply
#10

pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++)
uma vez me disseram que nгo usamos return dentro de um loop .-.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)