SA-MP Forums Archive
4 Errors help 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: 4 Errors help please. (/showthread.php?tid=267893)



4 Errors help please. - Davz*|*Criss - 10.07.2011

Hey guys i am watching this tutorial: http://forum.sa-mp.com/showthread.ph...59#post1284759

And i did the same as he did.

I got 4 errors i don't know how to fix it.

So please tell me what's wrong and fix it for me.

pawn Code:
/*
Flatron Gamemode [0.3c] 1.0 Loaded!

*/


#include <a_samp>
#include <SII>

//Register & Login Dialogs.

#define DIALOG_REGISTER 2000
#define DIALOG_LOGIN 2001

#if defined FILTERSCRIPT

//Colors
#define WHITE "{FFFFFF}"
#define SERVERCOL "{C35617}"
#define RED "{F81414}"

/*------------------------------.------------------------------*/
new gPlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
/*------------------------------.Enums.------------------------------*/
enum pInfo
{
    pPass,
    pScore,
    pCash,
    pAdmin,
}
new PlayerInfo[MAX_PLAYERS][pInfo];

//Stock
stock getINI(playerid)
{
  new account[64];
  format(account,30,"Users/%s.ini",gPlayerName[playerid]);
  return account;
}

main()
{
    print("\n--------------------------------------");
    print(" Flatron Gamemode [0.3c] 1.0 Loaded!");
    print("--------------------------------------\n");
}

#endif

public OnGameModeInit()
{
    //GameMode Text.
    SetGameModeText("San Andreas");
    return 1;
}

public OnPlayerConnect(playerid)
{
    //Connect Message.
    new string[64], jName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,jName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{C35617}%s (ID %d) has joined the server.",jName,playerid);
    SendClientMessageToAll(0xFFFFFFAA,string);
   
    //Register & Login Dialogs.
    GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
    if (fexist(getINI(playerid)))
    {
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login Dialog.",""SERVERCOL"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""WHITE"Register Dialog.",""SERVERCOL"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(INI_Open(getINI(playerid))) {

    INI_WriteInt("Score",PlayerInfo[playerid][pScore]);
    INI_WriteInt("Cash",PlayerInfo[playerid][pCash]);
    INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);

    INI_Save();
    INI_Close();
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if (response)
            {
                if(!strlen(inputtext)) {
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""WHITE"Register Dialog.",""RED"You have entered an invalid password.\n"SERVERCOL"Type your password below to register a new account.","Register","Quit");
                }

                if(INI_Open(getINI(playerid))) {
                INI_WriteString("Password",inputtext);
                INI_WriteInt("Score",1);
                INI_WriteInt("Cash",5000);
                INI_WriteInt("Admin",0);

                INI_Save();
                INI_Close();

                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login Dialog.",""RED"You have entered an incorrect password.\n"SERVERCOL"Type your password below to login.","Login","Quit");
            }
        }
    }
        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(!strlen(inputtext)) {
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login Dialog.",""RED"You have entered an invalid password.\n"SERVERCOL"Type your password below to login.","Login","Quit");
                }

                if(INI_Open(getINI(playerid))) {
                INI_ReadString(PlayerInfo[playerid][pPass],"Password",20);

                if(strcmp(inputtext,PlayerInfo[playerid][pPass],false)) {
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login Dialog.",""RED"You have entered an incorrect password.\n"SERVERCOL"Type your password below to login.","Login","Quit");
                }

                PlayerInfo[playerid][pScore] = INI_ReadInt("Score");
                GivePlayerMoney(playerid, INI_ReadInt("Cash"));
                PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
                INI_Close();
                }
            }
        }
    }
    return 1;
}
Errors:

pawn Code:
C:\Users\Axme\Desktop\SA-MP\gamemodes\Sm.pwn(66) : error 017: undefined symbol "gPlayerName"
C:\Users\Axme\Desktop\SA-MP\gamemodes\Sm.pwn(66) : warning 215: expression has no effect
C:\Users\Axme\Desktop\SA-MP\gamemodes\Sm.pwn(66) : error 001: expected token: ";", but found "]"
C:\Users\Axme\Desktop\SA-MP\gamemodes\Sm.pwn(66) : error 029: invalid expression, assumed zero
C:\Users\Axme\Desktop\SA-MP\gamemodes\Sm.pwn(66) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Thanks


Re: 4 Errors help please. - [HiC]TheKiller - 10.07.2011

Put

pawn Code:
#define filterscript
at the top or delete these two lines
pawn Code:
#if defined FILTERSCRIPT
and

pawn Code:
#endif



Re: 4 Errors help please. - Jeffry - 10.07.2011

Add at TOP:
pawn Code:
#define FILTERSCRIPT
or remove the:
pawn Code:
#if defined FILTERSCRIPT
(...) and
#endif
Both would work.

EDIT: [HiC]TheKiller was faster. ^^


Re: 4 Errors help please. - Davz*|*Criss - 10.07.2011

Thanks very much its fixed now