SA-MP Forums Archive
[Ajuda] Simples rep+ - 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] Simples rep+ (/showthread.php?tid=437534)



Simples rep+ - Duduloch - 16.05.2013

Gente ta dando erro aki:

pawn Код:
PlayerInfo[playa][Pontos] = result;
PlayerInfo:
pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
pInfo:

pawn Код:
enum pInfo
{
    Pontos
};
erro:
PHP код:
(18803) : error 006must be assigned to an array 
Ajudem pfvr!!!


Re: Simples rep+ - BreakDriFT - 16.05.2013

Oque tem nessa variбvel result ? Numeros ou textos ?


Re: Simples rep+ - Duduloch - 16.05.2013

Numeros


Re: Simples rep+ - TreePuncher - 16.05.2013

Pode passar a linha onde result foi declarada?


Re: Simples rep+ - Duduloch - 16.05.2013

PHP код:
new length strlen(cmdtext);
                        while ((
idx length) && (cmdtext[idx] <= ' '))
                        {
                            
idx++;
                        }
                        new 
offset idx;
                        new 
result[64];
                        while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                        {
                            
result[idx offset] = cmdtext[idx];
                            
idx++;
                        }
                        
result[idx offset] = EOS



Re: Simples rep+ - Lуs - 16.05.2013

Mostre o cуdigo inteiro.


Re: Simples rep+ - Duduloch - 16.05.2013

ta ai lуs

PHP код:
    if(strcmp(cmd"/darptsdonate"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USE: /darptsdonate [id] [pontos]");
                return 
1;
            }
            new 
playa;
            
playa ReturnUser(tmp);
            
tmp strtok(cmdtextidx);
            if (
PlayerInfo[playerid][pAdmin] == 3000 && ServerOwner[playerid] == 1)
            {
                if(
IsPlayerConnected(playa))
                {
                    if(
playa != INVALID_PLAYER_ID)
                    {
                        new 
length strlen(cmdtext);
                        while ((
idx length) && (cmdtext[idx] <= ' '))
                        {
                            
idx++;
                        }
                        new 
offset idx;
                        new 
result[64];
                        while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                        {
                            
result[idx offset] = cmdtext[idx];
                            
idx++;
                        }
                        
result[idx offset] = EOS;
                        if(!
strlen(result))
                        {
                            
SendClientMessage(playeridCOLOR_GRAD2"USE: /darptsdonate [id] [pontos]");
                            return 
1;
                        }
                        
ptss strval(tmp);
                        
GetPlayerName(playeridsendernameMAX_PLAYER_NAME);
                        
GetPlayerName(playagiveplayerMAX_PLAYER_NAME);
                        
PlayerInfo[playa][Pontos] = result;
                        
format(stringsizeof(string), "Vocк deu %s pontos de donate para o player: %s!"resultgiveplayer);
                        
SendClientMessage(playeridCOLOR_GRAD1string);
                        
format(stringsizeof(string), "Vocк recebeu %s pontos de donate do dono admin: %s"resultsendername);
                        
SendClientMessage(playaCOLOR_GRAD1string);
                    }
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD1"   Vocк nгo tem permissao para usar esse comando!");
            }
        }
        return 
1;
    } 



Re: Simples rep+ - TreePuncher - 16.05.2013

o RESULT й uma string, vc tem que converter para um valor inteiro (int) -.-


Re: Simples rep+ - Duduloch - 16.05.2013

Sou leigo ainda em pawn, poderia me explicar oque preciso fazer?


Re: Simples rep+ - BreakDriFT - 16.05.2013

strval(result);

Ou tente trocar esta linha:
pawn Код:
PlayerInfo[playa][Pontos] = result;

Para:
pawn Код:
PlayerInfo[playa][Pontos] = strval(tmp);