[Ajuda] O que estб mal neste cуdigo ?
#1

pawn Код:
if(strcmp(cmd,"/amudarnick",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /amudarnick [ id ]");
                return 1;
            }
            new playa;
            playa = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] == 1341)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        MudarNickAceito[playa] = 1;
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        //format(string, sizeof(string), "Vocк autorizou %s a mudar o nick.", giveplayer);
                        //SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "Admin %s: Autorizou vocк a mudar o nick, digite /mudarnick.", sendername);
                        SendClientMessage(playa, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "ADMIN CMD: %s autorizou %s a mudar o nick !",sendername,giveplayer);
                        ABroadCast(COLOR_LIGHTRED,string,1);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб autorizado a usar este comando!");
                return 1;
            }
        }
        return 1;
    }
Eu tento compilar e dб erro , aparece-me isto:


error 001: expected token: ";", but found "new"
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 021: symbol already defined: "playa"
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 021: symbol already defined: "format"
error 021: symbol already defined: "ABroadCast"
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
warning 203: symbol is never used: "playa"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


14 Errors.

O que й que devo fazer ?
Reply
#2

Tem duas variбveis playa, tem duas variбveis ABroadCast, em alguma linha vocк esqueceu de colocar ";", alguma funзгo ta com argumentos invбlidos. Mais detalhes:
http://twixar.me/wnd
Reply
#3

pawn Код:
if(strcmp(cmd,"/amudarnick",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] != 1341) return SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб autorizado a usar este comando!");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /amudarnick [ id ]");
                return 1;
            }
            new playaid;
            playaid = ReturnUser(tmp);
            if(IsPlayerConnected(playaid))
            {
                if(playaid != INVALID_PLAYER_ID)
                {
                    MudarNickAceito[playaid] = 1;
                    GetPlayerName(playaid, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    //format(string, sizeof(string), "Vocк autorizou %s a mudar o nick.", giveplayer);
                    //SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    format(string, sizeof(string), "Admin %s: Autorizou vocк a mudar o nick, digite /mudarnick.", sendername);
                    SendClientMessage(playaid, COLOR_LIGHTBLUE, string);
                    format(string, sizeof(string), "ADMIN CMD: %s autorizou %s a mudar o nick !",sendername,giveplayer);
                    ABroadCast(COLOR_LIGHTRED,string,1);
                }
            }
        }
        return 1;
    }
Procure mais sobre variбveis e tente estudar, nгo apenas copie cуdigos! Abraзos
Reply
#4

Bruno , eu nгo sei por onde comeзar mas se encontrar algo , prometo que estudo. Tentei esse cуdigo que vocк mandou e deu erro , apareceu-me isto:

error 001: expected token: ";", but found "new"
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
warning 219: local variable "playa" shadows a variable at a preceding level
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
symbol already defined: "format"
error 021: symbol already defined: "ABroadCast"
error 010: invalid function or declaration
warning 203: symbol is never used: "playa"
warning 203: symbol is never used: "playaid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


12 Errors.

---

Serб que me podia ajudar , imploro..
Reply
#5

Vocк jб tentou sabe a CAUSA dos erros e nгo a SOLUЗГO?
Pesquise isso: shadows a variable at a preceding level no ******, se aparecer uma resposta em outra lingua, joga no ****** tradutor. Vocк implora? Ta mesmo necessitado em, mas nгo parece. Um erro tгo simples e tгo comum e vocк fica dependendo do fуrum. Se vira rapaz.
Reply
#6

pawn Код:
if(strcmp(cmd,"/amudarnick",true)==0)
{
    if(IsPlayerConnected(playerid))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
            return SendClientMessage(playerid, COLOR_GRAD2, "USE: /amudarnick [ id ]");
       
        if(!(PlayerInfo[playerid][pAdmin] == 1341))
            return SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб autorizado a usar este comando!");
        if(IsPlayerConnected(ReturnUser(tmp)) && ReturnUser(tmp) != INVALID_PLAYER_ID)
        {
            MudarNickAceito[ReturnUser(tmp)] = 1;
            GetPlayerName(ReturnUser(tmp), giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "Admin %s: Autorizou vocк a mudar o nick, digite /mudarnick.", sendername);
            SendClientMessage(ReturnUser(tmp), COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "ADMIN CMD: %s autorizou %s a mudar o nick !",sendername,giveplayer);
            ABroadCast(COLOR_LIGHTRED,string,1);
        }
    }
    return 1;
}
https://sampforum.blast.hk/showthread.php?tid=252966
Reply
#7

Й que tipo , eu sou iniciante nгo percebo muito disto . Jб resolvi uns erros sу que ainda falta corrigir uns , os erros sгo:

invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 021: symbol already defined: "ReturnUser"
error 029: invalid expression, assumed zero
error 021: symbol already defined: "ReturnUser"
fatal error 107: too many error messages on one line

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


11 Errors.


Quem me puder ajudar , que diga ai , agora vou ver o que devo fazer para corrigir isto.
Reply
#8

Te aconselho aprender Lуgica de Programaзгo. Procure no ******: "Lуgica de Programaзгo em PASCAL"
Reply
#9

https://sampforum.blast.hk/showthread.php?tid=252966
https://sampforum.blast.hk/showthread.php?tid=497801

Vai estudar, abraзos.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)