[Ajuda] Dъvida SendClientMessageToAll
#1

Galera oque preciso pra fazer com que quando o player vip digitar /jetpack, mandar uma mensagem a todos do servidor tipo:

"Fulano %s pegou seu jetpack super vip!"
Reply
#2

Aprenda format.
Reply
#3

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Aprenda format.
Achei sу em inglкs, poderia me enviar algum em portuguкs por gentileza, porque eu eu traduzir a pбgina traduz os cуdigo e fica ruim pra entender...
Reply
#4

Traduza, amigo.

PHP код:
new msg[60];
format(msgsizeof(msg), "%s foi atй a porta." getName(playerid)); 
Reply
#5

Й como o ipsLuan disse, se estб inglкs traduza, pesquise coisas relacionadas aqui no fуrum tambйm, com certeza irб achar uma base, nгo fique criando post pra tudo, se ao menos nem tentou. Estude o cуdigo pelo menos...
PHP код:
CMD:jetpack(playerid)
{
    new 
name[MAX_PLAYER_NAME], string[128];
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "%s pegou seu jetpack super vip!"name);
    
SendClientMessageToAll(-1string);
    return 
1;

Reply
#6

Quote:
Originally Posted by SmokeKiLL
Посмотреть сообщение
Й como o ipsLuan disse, se estб inglкs traduza, pesquise coisas relacionadas aqui no fуrum tambйm, com certeza irб achar uma base, nгo fique criando post pra tudo, se ao menos nem tentou. Estude o cуdigo pelo menos...
PHP код:
CMD:jetpack(playerid)
{
    new 
name[MAX_PLAYER_NAME], string[128];
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "%s pegou seu jetpack super vip!"name);
    
SendClientMessageToAll(-1string);
    return 
1;

No caso fica assim entгo ?

PHP код:
if(strcmp(cmdtext"/jetpack"true) == 0)
    {
    if(
PlayerInfo[playerid][pVIP] >= 2)
      {
        new 
name[MAX_PLAYER_NAME], string[128];
        
GetPlayerName(playeridnamesizeof(name));
        
format(stringsizeof(string), "O %s pegou jetpack"name);
        
SendClientMessageToAll(-1string);
        return 
true;
        }
        
SetPlayerSpecialAction(playerid2);
        
SendClientMessage(playeridCOR_ADMIN"[BENEFICIARIO]: vOCК PEGOU JETPACK");
        
SendClientMessage(playeridCOR_ADMIN"ACESSE NOSSO /FORUM");
        
SendClientMessage(playeridCOLOR_YELLOW"[Erro]: VOCE NГO Й BENEFICIARIO VIP");
        
SendClientMessage(playeridCOLOR_YELLOW"[Erro]: Acesse NOSSO /FORUM !!");
    }
    return 
1;

Reply
#7

PHP код:
if(strcmp(cmdtext"/jetpack"true) == 0)
{
    if(
PlayerInfo[playerid][pVIP] >= 2)
    {
        
SetPlayerSpecialAction(playerid2);

        new 
name[MAX_PLAYER_NAME], string[128];
        
GetPlayerName(playeridnamesizeof(name));
        
format(stringsizeof(string), "O %s pegou jetpack"name);
        
SendClientMessageToAll(-1string);
        
        
SendClientMessage(playeridCOR_ADMIN"[BENEFICIARIO]: vOCК PEGOU JETPACK");
        
SendClientMessage(playeridCOR_ADMIN"ACESSE NOSSO /FORUM");
        
SendClientMessage(playeridCOLOR_YELLOW"[Erro]: VOCE NГO Й BENEFICIARIO VIP");
        
SendClientMessage(playeridCOLOR_YELLOW"[Erro]: Acesse NOSSO /FORUM !!");
    }
    return 
1;

Reply
#8

Quote:
Originally Posted by SmokeKiLL
Посмотреть сообщение
PHP код:
if(strcmp(cmdtext"/jetpack"true) == 0)
{
    if(
PlayerInfo[playerid][pVIP] >= 2)
    {
        
SetPlayerSpecialAction(playerid2);
        new 
name[MAX_PLAYER_NAME], string[128];
        
GetPlayerName(playeridnamesizeof(name));
        
format(stringsizeof(string), "O %s pegou jetpack"name);
        
SendClientMessageToAll(-1string);
        
        
SendClientMessage(playeridCOR_ADMIN"[BENEFICIARIO]: vOCК PEGOU JETPACK");
        
SendClientMessage(playeridCOR_ADMIN"ACESSE NOSSO /FORUM");
        
SendClientMessage(playeridCOLOR_YELLOW"[Erro]: VOCE NГO Й BENEFICIARIO VIP");
        
SendClientMessage(playeridCOLOR_YELLOW"[Erro]: Acesse NOSSO /FORUM !!");
    }
    return 
1;

Estou tentando compilar e o pawno para de funcionar
Reply
#9

no wiki samp jб tem um tutorial traduzido de como usar format em PT/BR

https://sampwiki.blast.hk/wiki/Format_PT

Mas vб pesquisar mais sobre, no forum tem bastante tуpicos pra sanar suas dъvidas, vocк nгo precisa criar tуpicos.

Seu cуdigo acima estб correto sim, desde que vocк tenha criado "string", de qualquer maneira, vocк tambйm pode criar um macro pra simplificar suas coisas

PHP код:
#define SendMessageFormattedToAll(%0,%1,%2); \
    
new smftall[128]; \
    
format(smftallsizeof(smftall), %1, %2); \
    
SendClientMessageToAll(%0smftall); 
Uso

SendMessageFormattedToAll(cor, "mensagens", parametros);

Por exemplo

SendMessageFormattedToAll(-1, "O %s pegou jetpack", name);
Reply
#10

@edit, jб identifiquei o erro...

й que estou tentando colocar para quando o player largar o jetpack ninguem poder pegar-lo para ele ser destruido automaticamente ao largar...

й o cуdigo que ta fazendo o pawno para

PHP код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    if(
newkeys == KEY_SECONDARY_ATTACK)
    {
        if(
GetPlayerSpecialAction(playerid) == 2)
        {
            
SetPlayerSpecialAction(playerid0);
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)