SA-MP Forums Archive
admin include problem - 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: admin include problem (/showthread.php?tid=577120)



admin include problem - Armageddonz - 09.06.2015

i want to test if my admin.inc is functioning...

this is my admin.inc
Код:
Admin Include v0.10
©Armageddon@Rexz
-------------------------------------------------
================================================================================
*/

//==============================================================================
// Administration
//==============================================================================


stock PlayerInfo(playerid, pAdmin)
{
	new tmp;
	new string[128],playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format( string, sizeof(string),PATH,playername);
	INI_Int("Admin", tmp;);
	if((IsPlayerConnected(playerid)) && (tmp >= 1) && (tmp!= 0))
	return string;
	else return false;
}
i create a new command to test if it work..
Код:
CMD:test(playerid, params[])
{
	if(PlayerInfo(playerid, 1)
	{
	    SendClientMessage(playerid, 0x0, "tax purposes");
	}
	return 1;
}
but i got this error
Код:
C:\Users\Armageddon\Desktop\Samp Server RC6\pawno\include\Aadmin.inc(35) : error 017: undefined symbol "name"
C:\Users\Armageddon\Desktop\Samp Server RC6\pawno\include\Aadmin.inc(35) : error 079: inconsistent return types (array & non-array)
C:\Users\Armageddon\Desktop\Samp Server RC6\pawno\include\Aadmin.inc(35) : error 029: invalid expression, assumed zero
C:\Users\Armageddon\Desktop\Samp Server RC6\pawno\include\Aadmin.inc(35) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: admin include problem - SoFahim - 09.06.2015

Your include problem. goto your include then defind name( Name ) thats it


Re: admin include problem - Armageddonz - 09.06.2015

like this ??

Код:
 #if defined _Aadmin_included
  #endinput
#endif
#define _Aadmin_included
#pragma library ladmin

#include <a_samp>
#include <YSI\y_ini>
#define name

#define PATH "/Users/%s.ini"



/*
================================================================================
-------------------------------------------------

Admin Include v0.10
©Armageddon@Rexz
-------------------------------------------------
================================================================================
*/

//==============================================================================
// Administration
//==============================================================================


stock PlayerInfo(playerid, pAdmin)
{
	new tmp;
	new string[128],playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format( string, sizeof(string),PATH,playername);
	INI_Int("Admin", tmp;);
	if((IsPlayerConnected(playerid)) && (tmp >= 1) && (tmp!= 0))
	return string;
	else return false;
}



Re: admin include problem - JaydenJason - 09.06.2015

Why are you using a stock? You should make an enum instead


Re: admin include problem - SoFahim - 09.06.2015

Ye. is it work? if not try with
Код:
new name



Re: admin include problem - Armageddonz - 09.06.2015

now i got this error

Код:
C:\Users\Armageddon\Desktop\Samp Server RC6\pawno\include\Aadmin.inc(36) : error 029: invalid expression, assumed zero
C:\Users\Armageddon\Desktop\Samp Server RC6\pawno\include\Aadmin.inc(36) : warning 215: expression has no effect
C:\Users\Armageddon\Desktop\Samp Server RC6\pawno\include\Aadmin.inc(36) : error 001: expected token: ";", but found ")"
C:\Users\Armageddon\Desktop\Samp Server RC6\pawno\include\Aadmin.inc(36) : error 029: invalid expression, assumed zero
C:\Users\Armageddon\Desktop\Samp Server RC6\pawno\include\Aadmin.inc(36) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: admin include problem - Armageddonz - 09.06.2015

can someone compile me a working code..


Re: admin include problem - mamorunl - 09.06.2015

Your errors in the first post make more sense. Except for the 'name' variable since it doesn't even get called.

The inconsistent types are:
variable 'string': which is an array of chars
variable 'false': which is a boolean

So you should either return true on the string, or return an empty string on the false.

Since you are using it in an 'if'-statement, I'd recommend replacing the 'string' return with a 'true' boolean.

The 'define name' and 'new name' don't make sense in this case and does not address the real issue.


Re: admin include problem - Armageddonz - 09.06.2015

and the problem still persist..i think i just make all in one gamemode .I need to change the admin system to another filterscript so the server can run efficiently..


Re: admin include problem - mamorunl - 09.06.2015

Код:
stock PlayerInfo(playerid, pAdmin)
{
	new tmp;
	new string[128],playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format( string, sizeof(string),PATH,playername);
	INI_Int("Admin", tmp);
	if((IsPlayerConnected(playerid)) && (tmp >= 1)) {
            return true;
	} else { 
            return false;
        }
}
This should work. I have removed an extra semi-colon at the INI_Int line, and removed the tmp != 0, since the tmp >=1 takes care of it already.