07.04.2010, 15:01
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
the stock of banplayer
could anyone please help me?
edit: forgot the 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;
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; }
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