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



4 Errors Please help fast - imnoob - 12.09.2012

ERROR's
Код:
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(145) : error 017: undefined symbol "gPlayerLogged"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(145) : warning 215: expression has no effect
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(145) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(145) : error 029: invalid expression, assumed zero
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(145) : fatal error 107: too many error messages on one line
LINE 145
Код:
	    if(gPlayerLogged[playerid] == 0)
	    {
	        SendClientMessage(playerid,white," Error: You must be logged in to use this!");
	        return 1;
		}



Re: 4 Errors Please help fast - MarkoN - 12.09.2012

add somewhere on top:
pawn Код:
new gPlayerLogged[MAX_PLAYERS];



Re: 4 Errors Please help fast - imnoob - 12.09.2012

now ?
Quote:

C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL _~1.PWN(117) : warning 204: symbol is assigned a value that is never used: "tmp"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL _~1.PWN(196) : warning 235: public function lacks forward declaration (symbol "OnPlayerLogin")
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL _~1.PWN(209) : error 017: undefined symbol "pPassword"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL _~1.PWN(211) : error 017: undefined symbol "pPassword"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL _~1.PWN(225) : error 017: undefined symbol "gPlayerAccount"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL _~1.PWN(225) : warning 215: expression has no effect
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL _~1.PWN(225) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL _~1.PWN(225) : error 029: invalid expression, assumed zero
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL _~1.PWN(225) : fatal error 107: too many error messages on one line




Re: 4 Errors Please help fast - Benzke - 12.09.2012

Add on Top :
pawn Код:
forward OnPlayerLogin()
Do you have enum pInfo ?.. show it.


Re: 4 Errors Please help fast - Vince - 12.09.2012

Just stop copying stuff! You can't just do that and expect it to work just like that! Honestly, learn to script and create your own systems. If you insist on copying, then at least know where to look for dependencies.


Re: 4 Errors Please help fast - imnoob - 12.09.2012

Quote:
Originally Posted by Benzke
Посмотреть сообщение
Add on Top :
pawn Код:
forward OnPlayerLogin()
Do you have enum pInfo ?.. show it.
Код:
new gPlayerLogged[MAX_PLAYERS];
new pPassword[MAX_PLAYERS];

enum Info
{
	pLevel,
	pExp,
	pCash,
};
new PlayerInfo[MAX_PLAYERS][Info];
new levelexp = 1;
new ScoreOld;

forward String(string[]);
forward ScoreUpdate();
forward PayDay(playerid);
forward PlayerPlayMusic(playerid);
forward StopMusic();
forward OnPlayerLogin()



Re: 4 Errors Please help fast - Benzke - 12.09.2012

Okay.. compile it and show me the new codes.. also line 225.


Re: 4 Errors Please help fast - imnoob - 12.09.2012

Quote:
Originally Posted by Benzke
Посмотреть сообщение
Okay.. compile it and show me the new codes.. also line 225.
Код:
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(37) : error 001: expected token: ";", but found "public"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(119) : warning 204: symbol is assigned a value that is never used: "tmp"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(198) : error 025: function heading differs from prototype
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(198) : error 025: function heading differs from prototype
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(211) : error 033: array must be indexed (variable "pPassword")
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(213) : error 033: array must be indexed (variable "pPassword")
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(227) : error 017: undefined symbol "gPlayerAccount"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(227) : warning 215: expression has no effect
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(227) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(227) : error 029: invalid expression, assumed zero
C:\DOCUME~1\EA3B~1\Desktop\FREAKW~1\FILTER~1\LEVEL_~1.PWN(227) : fatal error 107: too many error messages on one line
227
Код:
gPlayerAccount[playerid] = 1;
213
Код:
if ((strcmp(PlayerInfo[playerid][pPassword], string, true, strlen(valtmp)-1) == 0))
211
Код:
fread(UserFile, valtmp);strmid(PlayerInfo[playerid][pPassword], valtmp, 0, strlen(valtmp)-1, 255);
Код:
public OnPlayerLogin(playerid,const string[])
{
    new pname2[MAX_PLAYER_NAME];
	new pname3[MAX_PLAYER_NAME];
	new string2[64];
	new string3[128];
	GetPlayerName(playerid, pname2, sizeof(pname2));
	format(string2, sizeof(string2), "%s.cer", pname2);
	new File: UserFile = fopen(string2, io_read);

	if (UserFile)
	{
		new valtmp[128];
		fread(UserFile, valtmp);strmid(PlayerInfo[playerid][pPassword], valtmp, 0, strlen(valtmp)-1, 255);

		if ((strcmp(PlayerInfo[playerid][pPassword], string, true, strlen(valtmp)-1) == 0))
		{
			new key[128],val[128];
 			new Data[128];
 			while(fread(UserFile,Data,sizeof(Data)))
			{
				key = ini_GetKey(Data);
                if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
                if( strcmp( key , "Exp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
                if( strcmp( key , "Cash" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
                GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
			}
			fclose(UserFile);
			gPlayerLogged[playerid] = 1;
			gPlayerAccount[playerid] = 1;
		    new score = PlayerInfo[playerid][pLevel];
            SetPlayerScore(playerid, score);
			GetPlayerName(playerid, pname3, sizeof(pname3));
			format(string3, sizeof(string3), "Succesfully logged in!");
			SendClientMessage(playerid, white,string3);
		}
		else
		{
			SendClientMessage(playerid, grey, "Invalid Password");
			fclose(UserFile);
		}
	}
	return 1;
}



Re: 4 Errors Please help fast - MarkoN - 12.09.2012

read about enums...https://sampforum.blast.hk/showthread.php?tid=318307

pawn Код:
enum Info
{
    pPassword[129],
    pLevel,
    pExp,
    pCash,
    gPlayerLogged
}



Re: 4 Errors Please help fast - Biesmen - 12.09.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
Just stop copying stuff! You can't just do that and expect it to work just like that! Honestly, learn to script and create your own systems. If you insist on copying, then at least know where to look for dependencies.


By copying scripts, you won't be improving your skills at all.