SA-MP Forums Archive
Errors in script - 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)
+--- Thread: Errors in script (/showthread.php?tid=449568)



Errors in script - Mafiaday - 09.07.2013

Hi,

I have just started out on a new script i was making but stumbled against a problem

Code:

pawn Код:
public OnPlayerConnect(playerid)
{
    gPlayerLogged[playerid] = 0;
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if (!dini_Exists(file))
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, your not registered mate, input your registration pw below", "Register", "Leave");
    }
    if(fexist(file))
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "Fucken awesome mate, your registered :D. Inpute your pw below", "Login", "Leave");
    }
    return 1;
}
Error:

pawn Код:
C:\Users\minec_000\Desktop\Scratch RP Server\gamemodes\Retract.pwn(72) : error 017: undefined symbol "gPlayerLogged"
C:\Users\minec_000\Desktop\Scratch RP Server\gamemodes\Retract.pwn(72) : warning 215: expression has no effect
C:\Users\minec_000\Desktop\Scratch RP Server\gamemodes\Retract.pwn(72) : error 001: expected token: ";", but found "]"
C:\Users\minec_000\Desktop\Scratch RP Server\gamemodes\Retract.pwn(72) : error 029: invalid expression, assumed zero
C:\Users\minec_000\Desktop\Scratch RP Server\gamemodes\Retract.pwn(72) : fatal error 107: too many error messages on one line
Anyhelp? Thanks!


Re: Errors in script - Cjgogo - 09.07.2013

Do you have this somewhere at the top of your script, search for it? IF NOT, add it and recompile your script.
pawn Код:
new gPlayerLogged[MAX_PLAYERS];



Re: Errors in script - Mafiaday - 09.07.2013

Erm yes i do have that.

pawn Код:
new gPlayerLogged[MAX_PLAYERS];



Re: Errors in script - Konstantinos - 09.07.2013

Is it above the OnPlayerConnect callback? Like global variables?

pawn Код:
#include <a_samp>
// rest of includes

// defines

new
    gPlayerLogged[ MAX_PLAYERS ]
;

// callbacks

public OnPlayerConnect(playerid)
{
    gPlayerLogged[playerid] = 0;
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if (!dini_Exists(file)) ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, your not registered mate, input your registration pw below", "Register", "Leave");
    else ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "Fucken awesome mate, your registered :D. Inpute your pw below", "Login", "Leave");
    return 1;
}



Re: Errors in script - Mafiaday - 09.07.2013

Yes, It is above. And i cant seem to solve the problem


Re: Errors in script - Cjgogo - 09.07.2013

To be really honest with you, this problem is really strange, I never ever called myself a PRO, but your problem makes me look stupid, I can't see what the problem is. The only thing I can ask you is if there's any other line where you use that variable. AND ALSO, if that is line 72(the one inside OnPlayerConnect), or you use it somewhere else BEFORE OnPlayerConnect as well.