[Ajuda] Duvida Bбsica.
#1

Gostaria de saber para fazer exemplo..
"O Player %s esta com duvida "
Aonde ta "%s" aparecer o nick do player eu gostaria de saber como eu posso fazer isso obg, uso strcmp
Reply
#2

pawn Код:
new string[128], pName[MAX_PLAYERS];
        GetPlaynew pName[MAX_PLAYERS];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "%s esta com duvida",pName);
    SendClientMessageToAll(-1,string);
Reply
#3

Eu boto isso no comando ?
Reply
#4

sim

ex
pawn Код:
if(!strcmp(cmdtext, "/duvida", true ) == 0)
{
//sua funзao
    new string[128], pName[MAX_PLAYERS];
    GetPlaynew pName[MAX_PLAYERS];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "%s esta com duvida",pName);
    SendClientMessageToAll(-1,string);
return 1 ;
}
Reply
#5

Quote:
Originally Posted by lKoDlFuLLaNNo
Посмотреть сообщение
sim

ex
pawn Код:
if(!strcmp(cmdtext, "/duvida",true ))
{
//sua funзao
    new string[128], pName[MAX_PLAYERS];
    GetPlaynew pName[MAX_PLAYERS];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "%s esta com duvida",pName);
    SendClientMessageToAll(-1,string);
return 1 ;
}
mais esse SendClientMessageToAll(-1,string); vai pro server todo para min por sу pro player eu boto SendClientMessage(-1,string);
correto ?
Reply
#6

Quote:
Originally Posted by LE4NDrO
Посмотреть сообщение
mais esse SendClientMessageToAll(-1,string); vai pro server todo para min por sу pro player eu boto SendClientMessage(-1,string);
correto ?
sim correto
Reply
#7

Quote:
Originally Posted by LE4NDrO
Посмотреть сообщение
mais esse SendClientMessageToAll(-1,string); vai pro server todo para min por sу pro player eu boto SendClientMessage(-1,string);
correto ?
Errado!
Para por so para o player que usou o comando ficaria:
pawn Код:
SendClientMessage(playerid, -1, string);
Reply
#8

Outra coisa, vocкs devem ter cuidado com comandos assim. !
pawn Код:
if(!strcmp(cmdtext, "/duvida",true ))
Dessa forma fica muito livre, no caso se tiver um comando depois desse.
pawn Код:
if(!strcmp(cmdtext, "/duvida opзao",true ))
O primeiro comando iria executar e parar no retorno e iria invalidar o segundo comando, assim nunca executando.

A funзгo strcmp trabalha com o parвmetro case sensitive, e lenght.

Estude um pouco sobre ela lKoDlFuLLaNNo, vocк jб sabe aonde fica a wiki.
Faзa alguns testes, como eu te disse no Skype.
Код:
Sу se aprende a programar programando!.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)