SA-MP Forums Archive
[Ajuda] Problema com "tmp". - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Problema com "tmp". (/showthread.php?tid=394187)



Problema com "tmp". - Ley - 21.11.2012

Boa Tarde.
Estou um pouco sumido do fуrum, porйm vejo sempre as postagens diariamente...
Enfim, estou com um problema relacionado com "tmp", estou scriptando uma pequena funзгo de mensagem privada, analise:
PHP код:
CMD:pm(playeridparams[]) {
    new 
idx;
    if(!
strlen(tmp1) || strlen(tmp1) > 5)
    {
        
SendClientMessage(playerid, -1"Uso: /pm (id) (mensagem)");
        return 
1;
    }
    new 
id strval(tmp1);
    new 
gMessage[126];
    
gMessage strrest(paramsidx);
    if(!
strlen(gMessage))
    {
        
SendClientMessage(playerid, -1"Uso: /pm (id) (mensagem)");
        return 
1;
    }
    if(!
IsPlayerConnected(id))
    {
        
SendClientMessage(playerid, -1"Jogador nгo estб conectado.");
        return 
1;
    }
    if(
playerid != id)
    {
        new 
sendername[MAX_PLAYER_NAME];
        new 
giveplayer[MAX_PLAYER_NAME], str[126];
        
GetPlayerName(playeridsendernamesizeof(sendername));
        
GetPlayerName(idgiveplayersizeof(giveplayer));
        
format(strsizeof(str),"• %s(%d): %s"giveplayeridgMessage);
        
SendClientMessage(playerid0xFFCC2299str);
        
format(strsizeof(str),"• %s(%d): %s"sendernameplayeridgMessage);
        
SendClientMessage(id0xFFFF22AAstr);
        
PlayerPlaySound(id10850.00.00.0);
        
printf("[ Admin ] PM de %s para %s: %s"sendernamegiveplayergMessage);
    }
    return 
1;

Porйm fica dando os seguintes erros;

PHP код:
error 017undefined symbol "tmp1" \/
if(!
strlen(tmp1) || strlen(tmp1) > 5)
error 017undefined symbol "tmp1" \/ 
new 
id strval(tmp1);
error 047: array sizes do not match, or destination array is too small \/
gMessage strrest(paramsidx); 
Alguйm poderia me ajudar, sou grato desde jб.


Re: Problema com "tmp". - Coreia - 21.11.2012

tira o tmp1 e poe 'tmp'

e no gMessage
no lugar de strrest poe = strtok e compila


Re: Problema com "tmp". - humildadeforever - 21.11.2012

Aproveite e use sscanf.


Re: Problema com "tmp". - Ley - 21.11.2012

Quote:
Originally Posted by Coreia
Посмотреть сообщение
tira o tmp1 e poe 'tmp'

e no gMessage
no lugar de strrest poe = strtok e compila
Resolvido.

Humildadeforever...
Eu a um tempo atrбs utilizava sscanf, porйm quando fui testar no host linux, nada que utilizava sscanf funcionou ><
Baixei a include versгo linux e etc... Porйm sem sucesso.


Re: Problema com "tmp". - Coreia - 21.11.2012

Grato...


Re: Problema com "tmp". - Ley - 21.11.2012

Quote:
Originally Posted by humildadeforever
Посмотреть сообщение
Aproveite e use sscanf.
Quote:
Originally Posted by Coreia
Посмотреть сообщение
Grato...
Muito obrigado '-'
rep+


Re: Problema com "tmp". - humildadeforever - 21.11.2012

Ley, estava utilizando sscanf2?


Re: Problema com "tmp". - Ley - 21.11.2012

Quote:
Originally Posted by humildadeforever
Посмотреть сообщение
Ley, estava utilizando sscanf2?
Estava, a um tempo atrбs, porйm "larguei" o sscanf pelo motivo de nгo estб funionando ( ao meu ponto de vista ) no Linux.


Re: Problema com "tmp". - Maklister - 21.11.2012

Quote:
Originally Posted by Ley
Посмотреть сообщение
Estava, a um tempo atrбs, porйm "larguei" o sscanf pelo motivo de nгo estб funionando ( ao meu ponto de vista ) no Linux.
Estranho, sscanf2 pelo que eu vejo ainda nгo teve ninguйm falando sobre esse erro aqui,

sscanf2 com zcmd й uma otima combinaзгo, da uma olhada o por que nгo esta funcionando no linux
e passe a usar, pois alйm de ficar mais agil, prбtico, e de facil manuseio, й bem melhor de programar rs.