SA-MP Forums Archive
[Ajuda] 1 Erro E 2 Warnings - 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] 1 Erro E 2 Warnings (/showthread.php?tid=265902)



[Ajuda] 1 Erro E 2 Warnings - Tymer - 02.07.2011

Tenho Aki 1 Erro E 2 Warnings Que NГO CONSIGO TIRAR!

Erros + Warnings:
Quote:

C:\Users\Alexandre\Documents\Biblioteca\Alex\GTA San Andreas Multy E Singleplayer\GTA Samp\Servidor\Server Main File 3\pawno\include\dini.inc(239) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Alexandre\Documents\Biblioteca\Alex\GTA San Andreas Multy E Singleplayer\GTA Samp\Servidor\Server Main File 3\gamemodes\RPG.pwn(251) : error 004: function "ProxDetector" is not implemented
C:\Users\Alexandre\Documents\Biblioteca\Alex\GTA San Andreas Multy E Singleplayer\GTA Samp\Servidor\Server Main File 3\gamemodes\RPG.pwn(297) : warning 219: local variable "cmd" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Linhas:
Quote:

239: return 1;
251: ProxDetector(30.0, playerid,string,COLOR_WHITE,COLOR_WHITE,COLOR_WHIT E,COLOR_FADE1,COLOR_FADE2);
Linha 297: public OnRconCommand(cmd[])

Ajuda PF.

VLW!


Re: [Ajuda] 1 Erro E 2 Warnings - rjjj - 02.07.2011

Isto deve resolver o seu problema :



- Coloque no Final do seu GameMode, a funзгo abaixo :



pawn Код:
stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        //radi = 2.0; //Trigger Radius
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(!BigEar[i])
                {
                    GetPlayerPos(i, posx, posy, posz);
                    tempposx = (oldposx -posx);
                    tempposy = (oldposy -posy);
                    tempposz = (oldposz -posz);
                    //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
                    if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                    {
                        SendClientMessage(i, col1, string);
                    }
                    else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                    {
                        SendClientMessage(i, col2, string);
                    }
                    else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                    {
                        SendClientMessage(i, col3, string);
                    }
                    else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                    {
                        SendClientMessage(i, col4, string);
                    }
                    else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                    {
                        SendClientMessage(i, col5, string);
                    }
                }
                else
                {
                    SendClientMessage(i, col1, string);
                }
            }
        }
    }
    return 1;
}




- Vб na linha 297 e procure nas linhas que estiverem perto dela, por este cуdigo:




pawn Код:
new cmd

Tendo achado o mesmo, selecione o cуdigo: da palavra new atй o primeiro ; que vier depois de cmd.



Feito isso, apague o cуdigo selecionado .









- Entre na pasta pawno (a mesma onde estб o arquivo pawno.exe), e em seguida na pasta include.




Dentro da pasta include, abra o arquivo dini.inc e troque todo o cуdigo que estiver dentro dele, por este abaixo:




pawn Код:
/*
 *            Dini 1.6
 *       © Copyright 2006-2008 by DracoBlue
 *
 * @author    : DracoBlue (http://dracoblue.com)
 * @date      : 13th May 2006
 * @update    : 16th Sep 2008
 *
 * This file is provided as is (no warranties).
 *
 * It's released under the terms of MIT.
 *
 * Feel free to use it, a little message in
 * about box is honouring thing, isn't it?
 *
 */


#if defined _dini_included
  #endinput
#endif

#define _dini_included
#pragma library dini

#if defined MAX_STRING
#define DINI_MAX_STRING MAX_STRING
#else
#define DINI_MAX_STRING 255
#endif

stock dini_Exists(filename[]) {
    return fexist(filename);
}

stock dini_Remove(filename[]) {
    return fremove(filename);
}

stock dini_Create(filename[]) {
    if (fexist(filename)) return false;
    new File:fhnd;
    fhnd=fopen(filename,io_write);
    if (fhnd) {
        fclose(fhnd);
        return true;
    }
    return false;
}

stock dini_Set(filename[],key[],value[]) {
    // If we have no key, it can't be set
    // we also have no chance to set the value, if all together is bigger then the max string
    new key_length = strlen(key);
    new value_length = strlen(value);
    if (key_length==0 || key_length+value_length+2>DINI_MAX_STRING) return false;
   
    new File:fohnd, File:fwhnd;
    new tmpres[DINI_MAX_STRING];
    new bool:wasset=false;
   
    // Let's remove the old *.part file if there was one.
    format(tmpres,sizeof(tmpres),"%s.part",filename);
    fremove(tmpres);
   
    // We'll open the source file.
    fohnd=fopen(filename,io_read);
    if (!fohnd) return false;
   
    fwhnd=fopen(tmpres,io_write);
    if (!fwhnd) {
        // we can't open the second file for writing, so .. let's close the open one and exit.
        fclose(fohnd);
        return false;
    }
   
    while (fread(fohnd,tmpres)) {
        if (
            !wasset
            && tmpres[key_length]=='='
            && !strcmp(tmpres, key, true, key_length)  
        ) {
                // We've got what needs to be replaced!
                format(tmpres,sizeof(tmpres),"%s=%s",key,value);
                wasset=true;
        } else {
            DINI_StripNewLine(tmpres);
        }
        fwrite(fwhnd,tmpres);
        fwrite(fwhnd,"\r\n");
    }

    if (!wasset) {
        format(tmpres,sizeof(tmpres),"%s=%s",key,value);
        fwrite(fwhnd,tmpres);
        fwrite(fwhnd,"\r\n");
    }

    fclose(fohnd);
    fclose(fwhnd);

    format(tmpres,sizeof(tmpres),"%s.part",filename);
    if (DINI_fcopytextfile(tmpres,filename)) {
        return fremove(tmpres);
    }
    return false;
}


stock dini_IntSet(filename[],key[],value) {
   new valuestring[DINI_MAX_STRING];
   format(valuestring,DINI_MAX_STRING,"%d",value);
   return dini_Set(filename,key,valuestring);
}

stock dini_Int(filename[],key[]) {
   return strval(dini_Get(filename,key));
}

stock dini_FloatSet(filename[],key[],Float:value) {
   new valuestring[DINI_MAX_STRING];
   format(valuestring,DINI_MAX_STRING,"%f",value);
   return dini_Set(filename,key,valuestring);
}

stock Float:dini_Float(filename[],key[]) {
   return floatstr(dini_Get(filename,key));
}

stock dini_Bool(filename[],key[]) {
   return strval(dini_Get(filename,key));
}

stock dini_BoolSet(filename[],key[],value) {
    if (value) {
        return dini_Set(filename,key,"1");
    }
    return dini_Set(filename,key,"0");
}

stock dini_Unset(filename[],key[]) {
    // If we have no key, it can't be set
    // we also have no chance to unset the key, if all together is bigger then the max string
    new key_length = strlen(key);
    if (key_length==0 || key_length+2>DINI_MAX_STRING) return false;
   
    new File:fohnd, File:fwhnd;
    new tmpres[DINI_MAX_STRING];
   
    // Let's remove the old *.part file if there was one.
    format(tmpres,DINI_MAX_STRING,"%s.part",filename);
    fremove(tmpres);
   
    // We'll open the source file.
    fohnd=fopen(filename,io_read);
    if (!fohnd) return false;
   
    fwhnd=fopen(tmpres,io_write);
    if (!fwhnd) {
        // we can't open the second file for writing, so .. let's close the open one and exit.
        fclose(fohnd);
        return false;
    }
   
    while (fread(fohnd,tmpres)) {
        if (
            tmpres[key_length]=='='
            && !strcmp(tmpres, key, true, key_length)  
        ) {
                // We've got what needs to be removed!
        } else {
            DINI_StripNewLine(tmpres);
            fwrite(fwhnd,tmpres);
            fwrite(fwhnd,"\r\n");
        }
    }
   
    fclose(fohnd);
    fclose(fwhnd);

    format(tmpres,DINI_MAX_STRING,"%s.part",filename);
    if (DINI_fcopytextfile(tmpres,filename)) {
        return fremove(tmpres);
    }
    return false;
}

stock dini_Get(filename[],key[]) {
    new tmpres[DINI_MAX_STRING];
   
    new key_length = strlen(key);
    if (key_length==0 || key_length+2>DINI_MAX_STRING) return tmpres;
   
    new File:fohnd;
    fohnd=fopen(filename,io_read);
    if (!fohnd) return tmpres;
   
    while (fread(fohnd,tmpres)) {
        if (
            tmpres[key_length]=='='
            && !strcmp(tmpres, key, true, key_length)  
        ) {
            /* We've got what we need */
            DINI_StripNewLine(tmpres);
            strmid(tmpres, tmpres, key_length + 1, strlen(tmpres), DINI_MAX_STRING);
            fclose(fohnd);
            return tmpres;
        }
    }
    fclose(fohnd);
    return tmpres;
}


stock dini_Isset(filename[],key[]) {
    new key_length = strlen(key);
    if (key_length==0 || key_length+2>DINI_MAX_STRING) return false;
   
    new File:fohnd;
    fohnd=fopen(filename,io_read);
    if (!fohnd) return false;
   
    new tmpres[DINI_MAX_STRING];
    while (fread(fohnd,tmpres)) {
        if (
                tmpres[key_length]=='='
            &&  !strcmp(tmpres, key, true, key_length) 
        ) {
            // We've got what we need
            fclose(fohnd);
            return true;
        }
    }
    fclose(fohnd);
    return false;
}



stock DINI_StripNewLine(string[]) {
    new len = strlen(string);
    if (string[0]==0) return ;
    if ((string[len - 1] == '\n') || (string[len - 1] == '\r')) {
        string[len - 1] = 0;
        if (string[0]==0) return ;
        if ((string[len - 2] == '\n') || (string[len - 2] == '\r')) string[len - 2] = 0;
    }
}

stock DINI_fcopytextfile(oldname[],newname[]) {
    new File:ohnd,File:nhnd;
    if (!fexist(oldname)) return false;
    ohnd=fopen(oldname,io_read);
    if (!ohnd) return false;
    nhnd=fopen(newname,io_write);
    if (!nhnd) {
        fclose(ohnd);
        return false;
    }
    new tmpres[DINI_MAX_STRING];
    while (fread(ohnd,tmpres)) {
        DINI_StripNewLine(tmpres);
        format(tmpres,sizeof(tmpres),"%s\r\n",tmpres);
        fwrite(nhnd,tmpres);
    }
    fclose(ohnd);
    fclose(nhnd);
    return true;
}



Espero ter ajudado .


Re: [Ajuda] 1 Erro E 2 Warnings - Tymer - 03.07.2011

Vlw, Mas Agora Aparece Estes Erros:

Quote:

C:\Users\Alexandre\Documents\Biblioteca\Alex\GTA San Andreas Multy E Singleplayer\GTA Samp\Servidor\Server Main File 3\pawno\include\dini.inc(239) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Alexandre\Documents\Biblioteca\Alex\GTA San Andreas Multy E Singleplayer\GTA Samp\Servidor\Server Main File 3\gamemodes\RPG.pwn(490) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Alexandre\Documents\Biblioteca\Alex\GTA San Andreas Multy E Singleplayer\GTA Samp\Servidor\Server Main File 3\gamemodes\RPG.pwn(503) : error 017: undefined symbol "BigEar"
C:\Users\Alexandre\Documents\Biblioteca\Alex\GTA San Andreas Multy E Singleplayer\GTA Samp\Servidor\Server Main File 3\gamemodes\RPG.pwn(503) : warning 215: expression has no effect
C:\Users\Alexandre\Documents\Biblioteca\Alex\GTA San Andreas Multy E Singleplayer\GTA Samp\Servidor\Server Main File 3\gamemodes\RPG.pwn(503) : error 001: expected token: ";", but found "]"
C:\Users\Alexandre\Documents\Biblioteca\Alex\GTA San Andreas Multy E Singleplayer\GTA Samp\Servidor\Server Main File 3\gamemodes\RPG.pwn(503) : error 029: invalid expression, assumed zero
C:\Users\Alexandre\Documents\Biblioteca\Alex\GTA San Andreas Multy E Singleplayer\GTA Samp\Servidor\Server Main File 3\gamemodes\RPG.pwn(503) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.




Re: [Ajuda] 1 Erro E 2 Warnings - Tymer - 03.07.2011

(doublepost)


Re: [Ajuda] 1 Erro E 2 Warnings - Tymer - 04.07.2011

Me Dкem Ai Uma Ajuda, Pf.


Re: [Ajuda] 1 Erro E 2 Warnings - [BEP]AcerPilot - 04.07.2011

O primeiro aviso (warning 219) й na include dini. Acontece quando existem duas variбveis iguais no mesmo lugar. Dб para arrumar pelo seu gamemode, que й mais difнcil, pois pode ser em qualquer lugar dele (creio eu), ou na dini. Acessa essa include e muda a variбvel string da linha 239 para stringvar ou qualquer outra coisa (mudando o nome nos outros lugares que ela й usada para nгo dar mais erros).

Outro aviso (warning 219) vide acima, sу que agora й no gamemode. Й sу acessar a linha 490 do mesmo.

Erro 17 na linha 503: Defina a variбvel 'BigEar' (new BigEar.

Demais erros: na linha 503 tambйm. Provavelmente algum erro de digitaзгo estб causando eles, como a falta de um '(' ou de uma vнrgula. Cheque tudo.


Re: [Ajuda] 1 Erro E 2 Warnings - Tymer - 05.07.2011

Vlw.