SA-MP Forums Archive
5 errors - 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: 5 errors (/showthread.php?tid=646134)



5 errors - Krauser366 - 11.12.2017

Hi! This is the problem that I have

Quote:

C:\Users\Hector\Desktop\score save.pwn(59) : error 017: undefined symbol "file"
C:\Users\Hector\Desktop\score save.pwn(59) : error 001: expected token: ";", but found "]"
C:\Users\Hector\Desktop\score save.pwn(59) : error 029: invalid expression, assumed zero

Код:
	dini_IntSet( file, "Score", PlayerInfo[ playerid ][ pScore ]);
I expect that you can help me.


Re: 5 errors - RogueDrifter - 11.12.2017

You can expect that yes, first of all since you don't know what that is i assume that you don't know what a variable is, you haven't defined the variable you call "file", you're also using dini which isn't recommended by many obviously, i'd use ini but you obviously don't know how to use either so i would get started on ini instead or dini2 since I've just been advised to use that, so as said, the fix for the first error you need to define file, EX: new file[256];
As for the second error i suspect that you've done something wrong with PlayerInfo[playerid][pScore] if you can send the code where you defined that or included it i'd be able to help you further.


Re: 5 errors - Krauser366 - 11.12.2017

Quote:

if you can send the code where you defined that or included it

I assume that you mean, this one:

Код:
public OnPlayerDisconnect(playerid, reason)
{
	dini_IntSet( file, "Score", PlayerInfo[ playerid ][ pScore ]);
	return 1;
}



Re: 5 errors - RogueDrifter - 11.12.2017

No, i mean the enum or the new that defined both of your playerinfo and pscore.


Re: 5 errors - Krauser366 - 11.12.2017

There you go.

Код:
enum pInfo
{
    pScore
}
new PlayerInfo[ MAX_PLAYERS ][ pInfo ];

stock GetName(playerid)
{
     new name[ MAX_PLAYER_NAME+1 ];
     GetPlayerName(playerid, name, sizeof( name ));
     return name;
}



Re: 5 errors - RogueDrifter - 11.12.2017

Quote:
Originally Posted by Krauser366
Посмотреть сообщение
There you go.

Код:
enum pInfo
{
    pScore
}
new PlayerInfo[ MAX_PLAYERS ][ pInfo ];

stock GetName(playerid)
{
     new name[ MAX_PLAYER_NAME+1 ];
     GetPlayerName(playerid, name, sizeof( name ));
     return name;
}
I've just used the above code and got 0 errors... if you've declared the variable new file[256]; and still got errors please re-download the dini include, that should fix it. the code i used based on what you gave me:
PHP код:
#define FILTERSCRIPT
#include <a_samp>
#include <dini>
new file[256];
enum pInfo
{
    
pScore
}
new 
PlayerInfoMAX_PLAYERS ][ pInfo ];
stock GetName(playerid)
{
     new 
nameMAX_PLAYER_NAME+];
     
GetPlayerName(playeridnamesizeofname ));
     return 
name;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
dini_IntSetfile"Score"PlayerInfoplayerid ][ pScore ]);
    return 
1;




Re: 5 errors - Krauser366 - 11.12.2017

It works pretty cool. What was exactly the issue?


Re: 5 errors - RogueDrifter - 11.12.2017

Quote:
Originally Posted by Krauser366
Посмотреть сообщение
It works pretty cool. What was exactly the issue?
According to the info given by you, you forgot to declare the variable (file), you forgot to put
PHP код:
new fie[256]; 
at the top of your code.


Re: 5 errors - Krauser366 - 11.12.2017

Man... haha, well, thank you very much for your help.


Re: 5 errors - RogueDrifter - 11.12.2017

Np i forget lines myself as well, glad i could help.