[Ajuda] Warning no comando /R - Rбdio
#1

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 ?
Reply
#2

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;
}
Reply
#3

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;

Reply
#4

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;
}
Reply
#5

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

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

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;

Reply
#7

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!
Reply
#8

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);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)