Dъvida SendClientMessageToAll -
ScripterInicianteBR - 10.12.2018
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!"
Re: Dъvida SendClientMessageToAll -
ipsLuan - 10.12.2018
Aprenda format.
Re: Dъvida SendClientMessageToAll -
ScripterInicianteBR - 10.12.2018
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...
Re: Dъvida SendClientMessageToAll -
ipsLuan - 10.12.2018
Traduza, amigo.
PHP код:
new msg[60];
format(msg, sizeof(msg), "%s foi atй a porta." getName(playerid));
Re: Dъvida SendClientMessageToAll -
SmokeKiLL - 10.12.2018
Й 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(playerid, name, sizeof(name));
format(string, sizeof(string), "%s pegou seu jetpack super vip!", name);
SendClientMessageToAll(-1, string);
return 1;
}
Re: Dъvida SendClientMessageToAll -
ScripterInicianteBR - 10.12.2018
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(playerid, name, sizeof(name));
format(string, sizeof(string), "%s pegou seu jetpack super vip!", name);
SendClientMessageToAll(-1, string);
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(playerid, name, sizeof(name));
format(string, sizeof(string), "O %s pegou jetpack", name);
SendClientMessageToAll(-1, string);
return true;
}
SetPlayerSpecialAction(playerid, 2);
SendClientMessage(playerid, COR_ADMIN, "[BENEFICIARIO]: vOCК PEGOU JETPACK");
SendClientMessage(playerid, COR_ADMIN, "ACESSE NOSSO /FORUM");
SendClientMessage(playerid, COLOR_YELLOW, "[Erro]: VOCE NГO Й BENEFICIARIO VIP");
SendClientMessage(playerid, COLOR_YELLOW, "[Erro]: Acesse NOSSO /FORUM !!");
}
return 1;
}
Re: Dъvida SendClientMessageToAll -
SmokeKiLL - 10.12.2018
PHP код:
if(strcmp(cmdtext, "/jetpack", true) == 0)
{
if(PlayerInfo[playerid][pVIP] >= 2)
{
SetPlayerSpecialAction(playerid, 2);
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "O %s pegou jetpack", name);
SendClientMessageToAll(-1, string);
SendClientMessage(playerid, COR_ADMIN, "[BENEFICIARIO]: vOCК PEGOU JETPACK");
SendClientMessage(playerid, COR_ADMIN, "ACESSE NOSSO /FORUM");
SendClientMessage(playerid, COLOR_YELLOW, "[Erro]: VOCE NГO Й BENEFICIARIO VIP");
SendClientMessage(playerid, COLOR_YELLOW, "[Erro]: Acesse NOSSO /FORUM !!");
}
return 1;
}
Re: Dъvida SendClientMessageToAll -
ScripterInicianteBR - 10.12.2018
Quote:
Originally Posted by SmokeKiLL
PHP код:
if(strcmp(cmdtext, "/jetpack", true) == 0)
{
if(PlayerInfo[playerid][pVIP] >= 2)
{
SetPlayerSpecialAction(playerid, 2);
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "O %s pegou jetpack", name);
SendClientMessageToAll(-1, string);
SendClientMessage(playerid, COR_ADMIN, "[BENEFICIARIO]: vOCК PEGOU JETPACK");
SendClientMessage(playerid, COR_ADMIN, "ACESSE NOSSO /FORUM");
SendClientMessage(playerid, COLOR_YELLOW, "[Erro]: VOCE NГO Й BENEFICIARIO VIP");
SendClientMessage(playerid, COLOR_YELLOW, "[Erro]: Acesse NOSSO /FORUM !!");
}
return 1;
}
|
Estou tentando compilar e o pawno para de funcionar
Re: Dъvida SendClientMessageToAll -
Electrifying - 10.12.2018
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(smftall, sizeof(smftall), %1, %2); \
SendClientMessageToAll(%0, smftall);
Uso
SendMessageFormattedToAll(cor, "mensagens", parametros);
Por exemplo
SendMessageFormattedToAll(-1, "O %s pegou jetpack", name);
Re: Dъvida SendClientMessageToAll -
ScripterInicianteBR - 10.12.2018
@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(playerid, 0);
}
}
return 1;
}