#1

Hi, I'm making a gamemode right now that uses y_ini saving system, I created another folder called "Bans" to save the banned IPs, it all works except when I add this:
Код:
	new path[32], ip[16], username[MAX_PLAYER_NAME], bannedby[MAX_PLAYER_NAME], banreason[32], bandate[24];
	
	GetPlayerIp(playerid, ip, sizeof(ip));
	
	format(path, sizeof(path), "/Bans/%s.ini", ip);
	
	if (fexist(path))
	{
		new INI:File = INI_Open(path), string[248];
		
		INI_String("Username", username, 24);
		INI_String("BannedBy", bannedby, 24);
		INI_String("BanReason", banreason, 32);
		INI_String("BanDate", bandate, 24);
		
		format(string, sizeof(string), "Your IP (%s) is banned.\n\nUsername: %s\nBanned By: %s\nReason: %s \nDate: %s", ip, username, bannedby, banreason, bandate);
		ShowPlayerDialog(playerid, DIALOG_BANNED, DIALOG_STYLE_MSGBOX, "Banned", string, "Close", "");
		KickEx(playerid);
	}
under OnPlayerConnect I get these errors:
Код:
C:\Users\dell\Desktop\Team Deathmatch\gamemodes\TDM.pwn(385) : error 017: undefined symbol "name"
C:\Users\dell\Desktop\Team Deathmatch\gamemodes\TDM.pwn(385) : error 017: undefined symbol "value"
C:\Users\dell\Desktop\Team Deathmatch\gamemodes\TDM.pwn(386) : error 017: undefined symbol "name"
C:\Users\dell\Desktop\Team Deathmatch\gamemodes\TDM.pwn(386) : error 017: undefined symbol "value"
C:\Users\dell\Desktop\Team Deathmatch\gamemodes\TDM.pwn(387) : error 017: undefined symbol "name"
C:\Users\dell\Desktop\Team Deathmatch\gamemodes\TDM.pwn(387) : error 017: undefined symbol "value"
C:\Users\dell\Desktop\Team Deathmatch\gamemodes\TDM.pwn(388) : error 017: undefined symbol "name"
C:\Users\dell\Desktop\Team Deathmatch\gamemodes\TDM.pwn(388) : error 017: undefined symbol "value"
C:\Users\dell\Desktop\Team Deathmatch\gamemodes\TDM.pwn(383) : warning 204: symbol is assigned a value that is never used: "File"
I'm kinda new to y_ini. What am I doing wrong here? Do I need to do something with INI_ParseFile?
Reply
#2

Код:
	new path[32], ip[16], username[MAX_PLAYER_NAME], bannedby[MAX_PLAYER_NAME], banreason[32], bandate[24];
	
	GetPlayerIp(playerid, ip, sizeof(ip));
	
	format(path, sizeof(path), "/Bans/%s.ini", ip);
	
	if (fexist(path)) //Check if the IP is in the bans folder
	{
		new INI:File = INI_Open(path), string[248];
		
		INI_String("Username", username, 24);
		INI_String("BannedBy", bannedby, 24);
		INI_String("BanReason", banreason, 32);
		INI_String("BanDate", bandate, 24);
		
		format(string, sizeof(string), "Your IP (%s) is banned.\n\nUsername: %s\nBanned By: %s\nReason: %s \nDate: %s", ip, username, bannedby, banreason, bandate);
		ShowPlayerDialog(playerid, DIALOG_BANNED, DIALOG_STYLE_MSGBOX, "Banned", string, "Close", "");
		KickEx(playerid);
	}
That is your OnPlayerConnect Right>
Reply
#3

INI_String is just a macro that works in callbacks that are called by parsing a file.
You have to parse your file to read stuff from it.
Reply
#4

Quote:
Originally Posted by Stinged
Посмотреть сообщение
INI_String is just a macro that works in callbacks that are called by parsing a file.
You have to parse your file to read stuff from it.
How could I do that? I don't understand these parsing things. How can I put the data in the local strings?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)