adding bann to mysql--gadmin
#1

hello, im using gadmin as adminscript with the mysql plugin but this doesnt make mysql database on his with information about who's banned, the admin who banned him and the reason. so i wanted to make one but i get some errors:


the script:

the command
Code:
COMMAND:banip(playerid, params[]) {
	new pid;
	new idx;
	new AdminName[MAX_PLAYER_NAME];
	new pidName[MAX_PLAYER_NAME];

	if(PlayerInfo[playerid][AdminLevel] >= g_Level[lbanip]) {
		new
			giveid;
		if (sscanf(params, "u", giveid)) {
			return SendClientFormatMessage(playerid,COLOR_SYSTEM,"%s: /banip [Player / ID]",GetLanguageString(GetPlayerLanguageID(playerid),"txt_icommands"));
		}
		else if(!IsPlayerConnected(giveid)) {
			return SendClientLanguageMessage(playerid,COLOR_RED2,"txt_InvalidID");
		}
		else {
			if(PlayerInfo[giveid][AdminLevel]>=2) {
				return SendClientLanguageMessage(playerid,COLOR_RED2,"txt_rangeban1");
			}
			else {
		  		WriteIPBan(playerid,giveid);
	  			SendClientLanguageMessage(playerid,COLOR_GREEN,"txt_rangeban2");
				#if defined MYSQL
				GetPlayerName(pid, pidName, sizeof(pidName));
				GetPlayerName(playerid, AdminName, sizeof(AdminName));
	  		gSQL_BanUser(pid,AdminName,cmdtext[idx]);
	  			gSQL_SetUserVarAsInteger(PlayerName(giveid),"Trusted",-1);

	#else
				dUserSetINT(PlayerName(giveid)).("Trusted",-1);							  // Remove from Trusted
				#endif
				return KickEx(giveid,6);
	  		}
		}
	}
	else {
		SendClientLanguageMessage(playerid,COLOR_LIGHTBLUE,"txt_error404");
	}
	return 1;
the stock of banplayer

Code:
stock gSQL_BanUser(nickname[], Admin, Reason[])
{
  new
		sTmp[256],
    sqlcmd[256+128];
	strcat(sqlcmd, "INSERT INTO `" #MYSQL_DB "`.`" #MYSQL_BAN_TABLE "` (",sizeof(sqlcmd));
	strcat(sqlcmd,"`Name` ,`IP`,`Admin`)",sizeof(sqlcmd));
	format(sTmp, sizeof(sTmp), "VALUES ('%s' , '%s', '%s'", nickname, Admin, Reason, GetShortLanguageName(ServerLanguage()));
	strcat(sqlcmd, sTmp,sizeof(sqlcmd));
	if(samp_mysql_query(sqlcmd)) {
	  sTmp[0]='\0';
		format(sTmp, sizeof(sTmp), "User %s banned!", nickname);
		Log(sTmp);
	}
	return 1;
}
could anyone please help me?

edit: forgot the errors:

Code:
C:\Users\dieter\Desktop\gAdmin\filterscripts\gAdmin.pwn(5483) : error 035: argument type mismatch (argument 1)
C:\Users\dieter\Desktop\gAdmin\filterscripts\gAdmin.pwn(5483) : warning 215: expression has no effect
C:\Users\dieter\Desktop\gAdmin\filterscripts\gAdmin.pwn(5483) : error 001: expected token: ";", but found "]"
C:\Users\dieter\Desktop\gAdmin\filterscripts\gAdmin.pwn(5483) : error 029: invalid expression, assumed zero
C:\Users\dieter\Desktop\gAdmin\filterscripts\gAdmin.pwn(5483) : fatal error 107: too many error messages on one line
Reply
#2

Which line is 5483?
Reply
#3

gSQL_BanUser(pid,AdminName,cmdtext[idx]);

thats the line
Reply
#4

sorry for bump but i really need to get this working

please help
Reply
#5

help please?
Reply
#6

1111
Reply
#7

Quote:
Originally Posted by swredder
gSQL_BanUser(pid,AdminName,cmdtext[idx]);

thats the line
pid = variable

You have the function with the first parameter suppose to be a string.
Reply
#8

Quote:
Originally Posted by JeroenGFX
I'm sure the fix isn't that hard?

We really need help with this!
will you stop bumping? read the rules .
Reply
#9

Quote:
Originally Posted by Micko9
Quote:
Originally Posted by JeroenGFX
I'm sure the fix isn't that hard?

We really need help with this!
will you stop bumping? read the rules .
It's not that big of a deal seeing how he needed help and the thread was already two days old.
Reply
#10

thanks also it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)