SA-MP Forums Archive
[[[Help With One Error Please]]] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [[[Help With One Error Please]]] (/showthread.php?tid=267059)



[[[Help With One Error Please]]] - HayZatic - 07.07.2011

[[[Help With One Error Please]]]

Heres The Error

Код:
C:\Documents and Settings\Chris\My Documents\HayZaticFreeRoam\filterscripts\HZadmin1.pwn(91) : error 021: symbol already defined: "n"
Heres The Script.

Код:
public OnPlayerConnect(playerid)
{
    PInfo[playerid][Logged] = 0;
    PInfo[playerid][Regged] = 0;
    PInfo[playerid][Level] = 0;
    new n[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid,n,sizeof(n));
    format(file,sizeof(file),"HZadmin/HayZaticRegistrationSystem/%s.txt",n);
    if(dini_Exists(file))
    {
        SendClientMessage(playerid,LIGHTBLUE,"You are registered, Please /login!");
        PInfo[playerid][Regged] = 1;
        PInfo[playerid][Logged] = 0;
        return 1;
    }
    if(!dini_Exists(file))
    {
        SendClientMessage(playerid,LIGHTBLUE,"You are not registered, Please /register!");
        PInfo[playerid][Regged] = 0;
        PInfo[playerid][Logged] = 0;
        return 1;
    }

	new n[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid,n,sizeof(n));
    format(file,sizeof(file),"HZadmin/HayZaticRegistrationSystem/%s.txt",n);
    PInfo[playerid][Logged] = 0;
    if(dini_Exists(file))
             {
    dini_IntSet(file,"Logged",0);
    return 1;
             }
    return 0;
}



Re: [[[Help With One Error Please]]] - HayZatic - 07.07.2011

Bump


Re: [[[Help With One Error Please]]] - Basicz - 07.07.2011

.... It's already self explained....
Код:
error 021: symbol already defined: "n"
Variable "n" is already defined.

and so, the correct code is :

pawn Код:
public OnPlayerConnect(playerid)
{
    PInfo[playerid][Logged] = 0;
    PInfo[playerid][Regged] = 0;
    PInfo[playerid][Level] = 0;
    new n[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid,n,sizeof(n));
    format(file,sizeof(file),"HZadmin/HayZaticRegistrationSystem/%s.txt",n);
    if(dini_Exists(file))
    {
        SendClientMessage(playerid,LIGHTBLUE,"You are registered, Please /login!");
        PInfo[playerid][Regged] = 1;
        PInfo[playerid][Logged] = 0;
        dini_IntSet(file,"Logged",0);
        return 1;
    }
    if(!dini_Exists(file))
    {
        SendClientMessage(playerid,LIGHTBLUE,"You are not registered, Please /register!");
        PInfo[playerid][Regged] = 0;
        PInfo[playerid][Logged] = 0;
        return 1;
    }

    /* removed, useless
    new n[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid,n,sizeof(n));
    format(file,sizeof(file),"HZadmin/HayZaticRegistrationSystem/%s.txt",n);
    PInfo[playerid][Logged] = 0;
    if(dini_Exists(file))
    {
        //dini_IntSet(file,"Logged",0); moved this line to above code
        return 1;
    }*/

    return 1; // you returned 0 before, i got no idea
}
I suggest using SII, Y_INI, Djson, or other INI system(s), because DINI is slow...