[Pedido] Comando para chat global
#1

Preciso de uma linha de script para chat global

Exemplo: /cg(chat global)

Exemplo do chat: /cg(Nome do Player):

Agradeceria muito se o comando como esse > "CMD:cg(playerid)"
Reply
#2

PHP код:
CMD:cg(playerid, params[])
{
    new 
        
msg[256], 
        
msgplayer[126],
        
name[MAX_PLAYER_NAME];
    if(
sscanf(params, "s[126]", msgplayer))
        return 
SendClientMessage(playerid, -1, "[Erro]: Use: /cg (Mensagem)");
    
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    
format(msg, sizeof(msg), "[GLOBAL] %s(%d): %s", name, playerid, msgplayer);
    
SendClientMessageToAll(-1, msg);    
    return 
1;
} 
Reply
#3

Quote:
Originally Posted by Malandrin
Посмотреть сообщение
PHP код:
CMD:cg(playerid, params[])
{
    new 
        
msg[256], 
        
msgplayer[126],
        
name[MAX_PLAYER_NAME];
    if(
sscanf(params, "s[126]", msgplayer))
        return 
SendClientMessage(playerid, -1, "[Erro]: Use: /cg (Mensagem)");
    
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    
format(msg, sizeof(msg), "[GLOBAL] %s(%d): %s", name, playerid, msgplayer);
    
SendClientMessageToAll(-1, msg);    
    return 
1;
} 
Vlw mano, funcionou aqui
Poderia acrescentar um mini sistema que destaque o chat quando algum admin/socio/helper digita?

Exemplo: [GLOBAL] Admin %s(%d):
[GLOBAL]: Helper %s(%d):
[GLOBAL]: Sуcio %s(%d):

[pAdmin]
[pHelper]
[pVip]

iria ajudar mt mano
Reply
#4

PHP код:
CMD:cg(playerid, params[])
{
    new
        
msg[256],
        
msgplayer[126],
        
name[MAX_PLAYER_NAME];
    if(
sscanf(params, "s[126]", msgplayer))
        return 
SendClientMessage(playerid, -1, "[Erro]: Use: /cg (Mensagem)");
    
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    
format(msg, sizeof(msg), "[GLOBAL] %s %s(%d): %s", CargoAdmin(playerid), name, playerid, msgplayer);
    
SendClientMessageToAll(-1, msg);
    return 
1;
}
// Coloca encima ou embaixo dos seus comandos:
CargoAdmin(playerid)
{
    new 
Variavel[6];
    if(
PlayerInfo[playerid][pAdmin] == 1)
    
Variavel = "Admin";
    if(
PlayerInfo[playerid][pHelper] == 1)
    
Variavel = "Helper";
        
    if(
PlayerInfo[playerid][pSocio] == 1)
    
Variavel = "Sуcio";
        
    if(
PlayerInfo[playerid][pVip] == 1)
    
Variavel = "VIP";
    return 
1;
} 
Esqueci como faz, Mas tenta desse jeito Sу colocar as cores agora
Reply
#5

Quote:
Originally Posted by AutoMatic2
Посмотреть сообщение
PHP код:
CMD:cg(playerid, params[])
{
    new
        
msg[256],
        
msgplayer[126],
        
name[MAX_PLAYER_NAME];
    if(
sscanf(params, "s[126]", msgplayer))
        return 
SendClientMessage(playerid, -1, "[Erro]: Use: /cg (Mensagem)");
    
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    
format(msg, sizeof(msg), "[GLOBAL] %s %s(%d): %s", CargoAdmin(playerid), name, playerid, msgplayer);
    
SendClientMessageToAll(-1, msg);
    return 
1;
}
CargoAdmin(playerid)
{
    new 
Variavel[6];
    if(
PlayerInfo[playerid][pAdmin] == 1)
    
Variavel = "Admin";
    if(
PlayerInfo[playerid][pHelper] == 1)
    
Variavel = "Helper";
        
    if(
PlayerInfo[playerid][pSocio] == 1)
    
Variavel = "Sуcio";
        
    if(
PlayerInfo[playerid][pVip] == 1)
    
Variavel = "VIP";
    return 
1;
} 
Esqueci como faz, Mas tenta desse jeito Sу colocar as cores agora
PHP код:
return Variavel; 
Reply
#6

Deu esse erro manos:

error 047: array sizes do not match, or destination array is too small
error 047: array sizes do not match, or destination array is too small
error 017: undefined symbol "pVip"
error 047: array sizes do not match, or destination array is too small

Onde eu coloco a return Variavel;
Reply
#7

Quote:
Originally Posted by RayanSanty
Посмотреть сообщение
Deu esse erro manos:

error 047: array sizes do not match, or destination array is too small
error 047: array sizes do not match, or destination array is too small
error 017: undefined symbol "pVip"
error 047: array sizes do not match, or destination array is too small

Onde eu coloco a return Variavel;
PHP код:
CargoAdmin(playerid) 
{ 
    new 
Variavel[10]; 
    if(
PlayerInfo[playerid][pAdmin] == 1) 
    
Variavel = "Admin"; 
    if(
PlayerInfo[playerid][pHelper] == 1) 
    
Variavel = "Helper"; 
         
    if(
PlayerInfo[playerid][pSocio] == 1) 
    
Variavel = "Sуcio"; 
         
    if(
PlayerInfo[playerid][pVip] == 1) 
    
Variavel = "VIP"; 
    return 
Variavel; 
} 
Sobre o erro do pVIP й pq a variбvel pVIP nгo existe, sу remover ou trocar por uma existente.
Reply
#8

Quote:
Originally Posted by Malandrin
Посмотреть сообщение
PHP код:
CargoAdmin(playerid) 
{ 
    new 
Variavel[10]; 
    if(
PlayerInfo[playerid][pAdmin] == 1) 
    
Variavel = "Admin"; 
    if(
PlayerInfo[playerid][pHelper] == 1) 
    
Variavel = "Helper"; 
         
    if(
PlayerInfo[playerid][pSocio] == 1) 
    
Variavel = "Sуcio"; 
         
    if(
PlayerInfo[playerid][pVip] == 1) 
    
Variavel = "VIP"; 
    return 
Variavel; 
} 
Sobre o erro do pVIP й pq a variбvel pVIP nгo existe, sу remover ou trocar por uma existente.
Continuou a mesma coisa mano :/
O erro й em "Variavel ="
O resto tб de boas
Reply
#9

Qual a linha do erro e qual o erro?
Reply
#10

PHP код:
CargoAdmin(playerid) 
{ 
    new 
Variavel[10]; 
    if(
PlayerInfo[playerid][pAdmin] == 1) 
    
format(Variavel, sizeof(Variavel), "Admin");
    if(
PlayerInfo[playerid][pHelper] == 1) 
    
format(Variavel, sizeof(Variavel), "Helper");
         
    if(
PlayerInfo[playerid][pSocio] == 1) 
    
format(Variavel, sizeof(Variavel), "Socio"); 
         
    if(
PlayerInfo[playerid][pVip] == 1) 
    
format(Variavel, sizeof(Variavel), "Vip");
    return 
Variavel; 
} 
tente isso
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)