MySQL Ban system help
#1

I am trying to make a ban system for my server. but I get these errors and I dont know how to fix them...
Could someone help please?

Thanks

Errors:
Код:
LLA_v0.1.pwn(458) : error 047: array sizes do not match, or destination array is too small
LLA_v0.1.pwn(465) : error 017: undefined symbol "DIALOG_BANNED"
LLA_v0.1.pwn(449) : warning 204: symbol is assigned a value that is never used: "str"
Code:
Check Ban:
Код:
stock Checkban(playerid)
{
	new Query[500], rows, fields, pIP2[15], str[128];
	new bReason[500], bannedBy[128], savestr[500];
	GetPlayerIp(playerid, pIP2, sizeof(pIP2));
	mysql_format(dbHandle, Query, sizeof(Query), "SELECT * FROM `Bans` WHERE `Name` = '%e'", pName(playerid));
	mysql_query(dbHandle,Query);
	cache_get_data(rows, fields);
	if(rows)
	{
		cache_get_field_content(0, "Reason", savestr);			bReason = savestr;
/*Line 458*/    cache_get_field_content(0, "BannedBy", savestr);		bannedBy = savestr;
		
		new string[256], IP[24], dialogText[500];
		
		GetPlayerIp(playerid, IP, sizeof(IP));
        format(string, sizeof(string), "%s Banned - %s", COL_ORANGE, GetName(playerid));		
		format(dialogText, sizeof(dialogText), "You are banned from this server \n\nReason: %s\n\n Banned By: %s", bReason, bannedBy);
	    ShowPlayerDialog(playerid, DIALOG_BANNED, DIALOG_STYLE_MSGBOX, string, dialogText, "Ok", "");
	}
	return 0;
}
Ban Command:
Код:
CMD:ban(playerid, params[])
{
	if(pInfo[playerid][pAdminLevel] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorised to use that command.");
	new id, reason[56], string[235], Query[500], pIpAddress[15];
	if(sscanf(params, "us[20]", id, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ban [ID] [REASON]");
	format(string, sizeof(string), "ADMCMD: %s has been banned by %s. Reason: %s", GetName(id), GetName(playerid), reason);
	SendClientMessageToAll(COLOR_RED, string);
	GetPlayerIp(id, pIpAddress, sizeof(pIpAddress));
	strcat(Query,"INSERT INTO `bans`(`Name`,`Reason`,`BannedBy`,`IpAddress`,`Date`,`Status`)");
	strcat(Query," VALUES ('%s', '%s', '%s', '%s', '%s', 1)");
	mysql_format(dbHandle, Query, sizeof(Query), Query, pName(id), reason, GetName(playerid), pIpAddress, gettime());
	mysql_query(dbHandle, Query, false);
	Kick(id);
	return 1;
}
Reply
#2

Did u define Dialog_Banned?
Reply
#3

Yes
Sorry the new errors are:
Код:
LLA_v0.1.pwn(459) : error 047: array sizes do not match, or destination array is too small
Reply
#4

Ok I have fixed it I set all the string characters to 215 and it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)