SA-MP Forums Archive
adding bann to mysql--gadmin - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: adding bann to mysql--gadmin (/showthread.php?tid=140102)



adding bann to mysql--gadmin - swredder - 07.04.2010

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



Re: adding bann to mysql--gadmin - Hiddos - 07.04.2010

Which line is 5483?


Re: adding bann to mysql--gadmin - swredder - 07.04.2010

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

thats the line


Re: adding bann to mysql--gadmin - swredder - 07.04.2010

sorry for bump but i really need to get this working

please help


Re: adding bann to mysql--gadmin - swredder - 07.04.2010

help please?


1111 - JeroenGFX - 09.04.2010

1111


Re: adding bann to mysql--gadmin - Grim_ - 09.04.2010

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.


Re: adding bann to mysql--gadmin - Micko9 - 09.04.2010

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 .


Re: adding bann to mysql--gadmin - Grim_ - 09.04.2010

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.


Re: adding bann to mysql--gadmin - swredder - 09.04.2010

thanks also it works