01.07.2012, 01:18
Hey, i have a problem with my ban sistem...
It don't update the player fields how it need after a player get banned.
It put only 0 not the admin who banned, the reason and the date.
Link to ban page: http://s11.postimage.org/firlwf39d/image.jpg
Link to mysql structure: http://s11.postimage.org/wkkfyii4h/image.jpg
Let me show the code:
It don't update the player fields how it need after a player get banned.
It put only 0 not the admin who banned, the reason and the date.
Link to ban page: http://s11.postimage.org/firlwf39d/image.jpg
Link to mysql structure: http://s11.postimage.org/wkkfyii4h/image.jpg
Let me show the code:
Код:
if(strcmp(cmd, "/ban", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_IREAL_SYNTAX, "Syntax: /ban »PlayerId/PlayerName« [motivul]"); return 1; } giveplayerid = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 2) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "COMANDA: /banip »PlayerId/PlayerName« [motivul]"); return 1; } if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin] && playerid != giveplayerid) { new year, month,day; getdate(year, month, day); format(string, sizeof(string), "AdmCmd: %s a fost banat de AdmBot, Motivul: %s |/ban admin %s(%d-%d-%d)", sendername,(result),giveplayer,month,day,year); BanLog(string); format(string, sizeof(string), "AdmCmd: %s a fost banat de Admbot, Motivul: %s", sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); SendClientMessage(giveplayerid, COLOR_LIGHTRED, "Pentru unban viziteaza forum"); PlayerInfo[playerid][pLocked] = 1; format(string, sizeof(string), "UPDATE players SET Locked='%d' WHERE id=%d", PlayerInfo[playerid][pLocked], PlayerInfo[playerid][pSQLID]); samp_mysql_query(string); new r; format(string, sizeof(string), "autoban",r); strmid(PlayerInfo[playerid][pBAdmin], string, 0, strlen(string), 255); format(string, sizeof(string), "%02d/%02d/%d",day, month, year); strmid(PlayerInfo[playerid][pBDate], string, 0, strlen(string), 255); format(string, sizeof(string), "ban admin",r); strmid(PlayerInfo[playerid][pBReason], string, 0, strlen(string), 255); format(string, sizeof(string), "UPDATE players SET BAdmin='%s' WHERE id=%d", PlayerInfo[playerid][pBAdmin], PlayerInfo[playerid][pSQLID]); samp_mysql_query(string); format(string, sizeof(string), "UPDATE players SET BDate='%s' WHERE id=%d", PlayerInfo[playerid][pBDate], PlayerInfo[playerid][pSQLID]); samp_mysql_query(string); format(string, sizeof(string), "UPDATE players SET BReason='%s' WHERE id=%d", PlayerInfo[playerid][pBReason], PlayerInfo[playerid][pSQLID]); samp_mysql_query(string); Kick(playerid); return 1; } else { new year, month,day; getdate(year, month, day); format(string, sizeof(string), "AdmCmd: %s a fost banat de %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year); BanLog(string); format(string, sizeof(string), "AdmCmd: %s a fost banat de %s, motiv: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); SendClientMessage(giveplayerid, COLOR_LIGHTRED, "Pentru unban viziteaza www.star-gaming.ro"); PlayerInfo[giveplayerid][pLocked] = 1; format(string, sizeof(string), "UPDATE players SET Locked='%d' WHERE id=%d", PlayerInfo[giveplayerid][pLocked], PlayerInfo[giveplayerid][pSQLID]); samp_mysql_query(string); format(string, sizeof(string), "%02d/%02d/%d",day, month, year); strmid(PlayerInfo[giveplayerid][pBAdmin], sendername, 0, strlen(sendername), 255); strmid(PlayerInfo[giveplayerid][pBDate], string, 0, strlen(string), 255); strmid(PlayerInfo[giveplayerid][pBReason], result, 0, strlen(result), 255); format(string, sizeof(string), "UPDATE players SET BAdmin='%s' WHERE id=%d", PlayerInfo[giveplayerid][pBAdmin], PlayerInfo[giveplayerid][pSQLID]); samp_mysql_query(string); format(string, sizeof(string), "UPDATE players SET BDate='%s' WHERE id=%d", PlayerInfo[giveplayerid][pBDate], PlayerInfo[giveplayerid][pSQLID]); samp_mysql_query(string); format(string, sizeof(string), "UPDATE players SET BReason='%s' WHERE id=%d", PlayerInfo[giveplayerid][pBReason], PlayerInfo[giveplayerid][pSQLID]); samp_mysql_query(string); Ban(giveplayerid); return 1; } } }//not connected } else { format(string, sizeof(string), " %d nu este conectat.", giveplayerid); SendClientMessage(playerid, COLOR_LIGHTGREEN, string); } } return 1; } //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=unbanip=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= if(strcmp(cmd, "/unbanip", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 5) { tmp = strtok(cmdtext,idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /unbanip [ip]"); return 1; } format(string,sizeof(string),"unbanip %s",tmp); SendRconCommand(string); SendRconCommand("reloadbans"); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); PlayerInfo[giveplayerid][pLocked] = 0; format(string, 256, "AdmWarning: %s a scos banul de pe ip %s", sendername,tmp); ABroadCast(COLOR_YELLOW,string,1); } return 1; }