Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2017-05-21, 22:03


Michatex

PAWN Dev.






Wiek: 24
Na forum: 3990 dni
Posty: 90
Nick w MP: Michatex

Piwa: 1153

Respekt: 80

Siemka. Czy mo?e mi kto? wyt?umaczy? dlaczego mam error 219? Za odpowied? dam piwko i respekt. Poni?ej zamieszczam kod oraz tre?? jego.

Pawn

dcmd_changerank(playerid, params[])
{
    new RANK = PLAYER_RANK[playerid];
    if(RANK == 8 || RANK == 7 || RANK == 6 || RANK == 5)
    {
        new id;
        new RANK;
        new PLAYER[64];
        new Gname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Gname, sizeof(Gname));
        format(PLAYER, sizeof(PLAYER), "/acconts/%s.ini", Gname);
        if(dini_Exists(PLAYER))
        {
            if(sscanf(params, "ui", id, RANK))
            {
                SendClientMessage(playerid, COLOR_RED, "U?yj: /changerank [ID] [Ranga]");
            }
            else if(id == INVALID_PLAYER_ID)
            {
                SendClientMessage(playerid, COLOR_RED, "Gracza o tym ID nie ma na serwerze.");
                return 1;
            }
            else if(PLAYER_RANK[id] == RANK)
            {
                SendClientMessage(playerid, COLOR_RED, "Gracz o podanym ID posiada ju? t? rang?.");
                return 1;
            }
            else
            {
                PLAYER_RANK[id] = RANK;
                dini_IntSet(PLAYER, "Rank", RANK);
                SendClientMessage(playerid, COLOR_DEFAULT, "Pomy?lnie zmieniono graczowi rang?.");
                SendClientMessage(id, COLOR_DEFAULT, "Administrator zmieni? Tobie rang?.");
            }
            return 1;
        }
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "Nie jeste? administratorem.");
    }
    return 1;
}


Pawn

C:\Users\Sony\Desktop\samp037_svr_R2-1-1_win32\gamemodes\gamemode.pwn(138) : warning 219: local variable "RANK" shadows a variable at a preceding level
C:\Users\Sony\Desktop\samp037_svr_R2-1-1_win32\gamemodes\gamemode.pwn(139) : warning 219: local variable "PLAYER" shadows a variable at a preceding level
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.


Tak, tak. Wiem, ?e dcmd jest przestarza?y itp...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-05-21, 22:10


Wafelowski







Wiek: 30
Na forum: 5489 dni
Posty: 428

Piwa: 100

Respekt: 232
Respekt: 232Respekt: 232

Chodzi o to, ?e te zmienne stworzone masz wy?ej.

Pawn
dcmd_changerank(playerid, params[])
{
    new RANK = PLAYER_RANK[playerid];
    if(RANK == 8 || RANK == 7 || RANK == 6 || RANK == 5)
    {
        new id;
        new Gname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Gname, sizeof(Gname));
        format(PLAYER, sizeof(PLAYER), "/acconts/%s.ini", Gname);
        if(dini_Exists(PLAYER))
        {
            if(sscanf(params, "ui", id, RANK))
            {
                SendClientMessage(playerid, COLOR_RED, "U?yj: /changerank [ID] [Ranga]");
            }
            else if(id == INVALID_PLAYER_ID)
            {
                SendClientMessage(playerid, COLOR_RED, "Gracza o tym ID nie ma na serwerze.");
                return 1;
            }
            else if(PLAYER_RANK[id] == RANK)
            {
                SendClientMessage(playerid, COLOR_RED, "Gracz o podanym ID posiada ju? t? rang?.");
                return 1;
            }
            else
            {
                PLAYER_RANK[id] = RANK;
                dini_IntSet(PLAYER, "Rank", RANK);
                SendClientMessage(playerid, COLOR_DEFAULT, "Pomy?lnie zmieniono graczowi rang?.");
                SendClientMessage(id, COLOR_DEFAULT, "Administrator zmieni? Tobie rang?.");
            }
            return 1;
        }
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "Nie jeste? administratorem.");
    }
    return 1;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-05-21, 22:58


Michatex

PAWN Dev.






Wiek: 24
Na forum: 3990 dni
Posty: 90
Nick w MP: Michatex

Piwa: 1153

Respekt: 80

Wtedy dostaje co? takiego:

Pawn

C:\Users\Sony\Desktop\samp037_svr_R2-1-1_win32\gamemodes\gamemode.pwn(105) : warning 202: number of arguments does not match definition
C:\Users\Sony\Desktop\samp037_svr_R2-1-1_win32\gamemodes\gamemode.pwn(105) : warning 202: number of arguments does not match definition
C:\Users\Sony\Desktop\samp037_svr_R2-1-1_win32\gamemodes\gamemode.pwn(132) : error 010: invalid function or declaration
C:\Users\Sony\Desktop\samp037_svr_R2-1-1_win32\gamemodes\gamemode.pwn(132) : error 017: undefined symbol "params"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.


Podpis
Jeśli Ci w czymś pomogłem nie zapomnij o wystawieniu PIWA w ramach podziękowań. Mile widziany również jest RESPEKT.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-05-22, 10:28


Wafelowski







Wiek: 30
Na forum: 5489 dni
Posty: 428

Piwa: 100

Respekt: 232
Respekt: 232Respekt: 232

O ludzie, podstawy podstaw si? k?aniaj?.

Pawn
dcmd_changerank(playerid, params[])
{
    if(PLAYER_RANK[playerid] == 9 || PLAYER_RANK[playerid] == 7 || PLAYER_RANK[playerid] == 6 || PLAYER_RANK[playerid] == 5)
    {
        new 
            PlayerID, PlayerRank;

        if(sscanf(params, "ii", PlayerID, PlayerRank))
        {
            return SendClientMessage(playerid, COLOR_RED, "U?yj: /changerank [ID] [Ranga]");
        }
        
        if(!IsPlayerConnected(PlayerID))
        {
            return SendClientMessage(playerid, COLOR_RED, "Gracza o tym ID nie ma na serwerze.");                
        }

        if(PLAYER_RANK[PlayerID] == PlayerRank)
        {
            return SendClientMessage(playerid, COLOR_RED, "Gracz o podanym ID posiada ju? t? rang?.");
        }

        new 
            PlayerName[24 + 1], file[42 + 1];
            // Null-terminator

        GetPlayerName(PlayerID, PlayerName, 24 + 1);
        format(file, sizeof(file), "/accounts/%s.ini", pName);

        if(!dini_Exists(file))
        {
            return SendClientMessage(playerid, COLOR_RED, "Gracz nie posiada konta.");
        }

        dini_IntSet(file, "Rank", PlayerRank);

        SendClientMessage(playerid, COLOR_DEFAULT, "Pomy?lnie zmieniono graczowi rang?.");
        SendClientMessage(PlayerID, COLOR_DEFAULT, "Administrator zmieni? Tobie rang?.");
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "Nie jeste? administratorem.");      
    }
    return 1;
}


Postaw piwo autorowi tego posta
 

 
Tagi: error :: 219
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku