SA-MP Forums Archive
[Ajuda] Warning no comando /R - Rбdio - 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] Warning no comando /R - Rбdio (/showthread.php?tid=426733)



Warning no comando /R - Rбdio - rCr - 30.03.2013

Entгo galera, criei o comando /r para que os players possam falar entre os players de sua org .
Sу que da dando um Warning que eu nгo consigo resolver .

pawn Код:
C:\Users\rCr\Desktop\samp03x_svr_R1-2_win32\gamemodes\Untitled.pwn(654) : warning 219: local variable "Texto" shadows a variable at a preceding level
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

1 Warning.
pawn Код:
CMD:r(playerid, params [])
{
    new
        Str[120],
        Nome[25],
        Texto[120]
    ;

    if (sscanf(params, "s[120]", Texto))
    {
        SendClientMessage(playerid, Branco, "Use: /r(бdio) [ Texto ]");
    }
    else
    {
        GetPlayerName(playerid, Nome, 25);
        format(Str, sizeof(Str), "CHAT -> %s Diz: {88AA88}%s", Nome, Texto);

        new orgid = rCr[playerid][Organizacao] ;
        new Cor = GetPlayerColor(playerid);

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && rCr[i][Organizacao] == orgid) SendClientMessage(i, Cor, Str);
        }
    }
    return 1;
}
Alguйm sabe o por que disso ?


Respuesta: Warning no comando /R - Rбdio - Pedro Pawno - 30.03.2013

pawn Код:
CMD:r(playerid, params [])
{
    new
        Str[120],
        Nome[25],
        Texto[125]
    ;

    if (sscanf(params, "s[120]", Texto))
    {
        SendClientMessage(playerid, Branco, "Use: /r(бdio) [ Texto ]");
    }
    else
    {
        GetPlayerName(playerid, Nome, 25);
        format(Str, sizeof(Str), "CHAT -> %s Diz: {88AA88}%s", Nome, Texto);

        new orgid = rCr[playerid][Organizacao] ;
        new Cor = GetPlayerColor(playerid);

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && rCr[i][Organizacao] == orgid) SendClientMessage(i, Cor, Str);
        }
    }
    return 1;
}



Re: Warning no comando /R - Rбdio - Jefferson Santos - 30.03.2013

PHP код:
CMD:r(playeridparams [])
{
    new
        
Str[120],
        
Nome[25],
        
Texto[125]
    ;
    if (
sscanf(params"s[120]"Texto))
    {
        
SendClientMessage(playeridBranco"Use: /r(бdio) [ Texto ]");
    }
    else
    {
        
GetPlayerName(playeridNome25);
        
format(Strsizeof(Str), "CHAT -> %s Diz: {88AA88}%s"NomeTexto);
        new 
orgid rCr[playerid][Organizacao] ;
        new 
Cor GetPlayerColor(playerid);
        for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i) && rCr[i][Organizacao] == orgidSendClientMessage(iCorStr);
        }
    }
    return 
1;




Re: Warning no comando /R - Rбdio - Gii - 30.03.2013

pawn Код:
CMD:r(playerid, params []) {

    new
        Str[144],
        Nome[20]
    ;

    if (isnull(params))
        return SendClientMessage(playerid, Branco, "Use: /r(бdio) [ Texto ]");

    GetPlayerName(playerid, Nome, 20);
    format(Str, sizeof(Str), "CHAT -> %s Diz: {88AA88}%s", Nome, params);

    new orgid = rCr[playerid][Organizacao] ;
    new Cor = GetPlayerColor(playerid);

    for(new i = 0; i < MAX_PLAYERS; i++) {
       
        if(IsPlayerConnected(i) && rCr[i][Organizacao] == orgid)
            SendClientMessage(i, Cor, Str);
    }
    return true;
}



Re: Warning no comando /R - Rбdio - rCr - 30.03.2013

Dб no mesmo , os dois ai de cima :\

Programador : fala que o text nгo estб sendo usado .


Re: Warning no comando /R - Rбdio - smiiir - 30.03.2013

Tenta ae..

PHP код:
CMD:r(playeridparams [])
{
    new
        
xCelulas 120 ],
        
xNome 24 ],
        
xText 125 ]
    ;
    if (
sscanf(params"s[120]"xText))
    {
        
SendClientMessage(playeridBranco"Use: /r(бdio) [ Texto ]");
    }
    else
    {
        
GetPlayerName(playeridxNome24);
        
format(xCelulassizeof(xCelulas), "CHAT -> %s Diz: {88AA88}%s"xNomexText);
        new 
orgid rCr[playerid][Organizacao] ;
        new 
Cor GetPlayerColor(playerid);
        for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i) && rCr[i][Organizacao] == orgidSendClientMessage(iCorxCelulas);
        }
    }
    return 
1;




Re: Warning no comando /R - Rбdio - Gii - 30.03.2013

Quote:
Originally Posted by rCr
Посмотреть сообщение
Dб no mesmo , os dois ai de cima :\

Programador : fala que o text nгo estб sendo usado .
Dei um edit ja!


Re: Warning no comando /R - Rбdio - rCr - 30.03.2013

Deu certo iSmir .

Sу que eu mudei isso :

format(xCelulas, sizeof(xCelulas), "CHAT -> %s Diz: {88AA88}%s", xNome, Texto);

por isso :

format(xCelulas, sizeof(xCelulas), "CHAT -> %s Diz: {88AA88}%s", xNome, xText);