Temp Ban Command Mysql [+REP]
#1

PHP код:
CMD:tban(playerid,params[]) 

    if(
pInfo[playerid][pAdminLevel] < 2)return SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!"); 
    new 
targetid,reason[105],string[145],time
    if(
sscanf(params,"uis[105",targetid,time,reason))return SendClientMessage(playerid,-1,""chat" /tban [playerid][times(minutes)][reason]"); 
    if(!
IsPlayerConnected(targetid))return SendClientMessage(playerid,-1,""chat" Player is not online"); 
    
format(string,sizeof string,""chat""COL_WHITE" [{B3432B}ADMIN{FFFFFF}]%s {EEC900}banned{FFFFFF} [player:%s] [reason:%s] for %d minutes",PlayerName(playerid),PlayerName(targetid),reason,time); 
    
SendClientMessageToAll(-1,string); 
    
printf("%s %s has banned %s for %i minutes [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),time,reason); 
    
format(string,sizeof string,""COL_WHITE"["COL_CADMIN"ADMIN"COL_WHITE"]"COL_CGREY" %s > banned > %s > %i minutes",PlayerName(playerid),PlayerName(targetid),time); 
    
SendMessageToAllAduty(-1,string); 
    
TBanPlayer(targetid,playerid,reason,GetAdminName(playerid),time); 
    
format(string,sizeof string,"%s(%d) /tban %s(%d) %i minutes (Reason: %s)",GetName(playerid),playerid,GetName(targetid),targetid,time,reason); 
    new 
File:log fopen("CommandsUsed.txt",io_append); 
    
fwrite(log,string); 
    
fwrite(log,"\r\n"); 
    
fclose(log); 
    return 
1

stock TBanPlayer(targetid,playerid,reason[],admin[],time

    new 
playerIP,Hour,Minute,Second,Year,Month,Day,timeBanned[80],bannedstring[256],Query[256]; 
    
GetPlayerIp(playerid,playerIP,sizeof playerIP); 
    
gettime(Hour,Minute,Second); 
    
getdate(Year,Month,Day); 
    
format(timeBanned,sizeof timeBanned,"%02d:%02d:%02d on %02d/%02d/%d",Hour,Minute,Second,Day,Month,Year); 
    
mysql_format(mysql,Query,sizeof Query,"INSERT INTO `tbanlog` (`Name`,`pBannedReason`,`pBannedBy`,`pTime`,`pIPBanned`,`pAccountLock`,`pTBanEnd`) VALUES ('%s','%s','%s','%s','%s',1,'%s')"
    
PlayerName(targetid),reason,PlayerName(playerid),timeBanned,playerIP,gettime() + (time*60)); 
    
mysql_tquery(mysql,Query); 
    
format(bannedstring,sizeof bannedstring,"You are currently banned from this server.\r\nUser: %s \r\nIP: %s  \r\nTime: %s \r\nAdmin: %s\r\nReason: %s\r\nTBan End: in %i minutes"
    
PlayerName(targetid),playerIP,timeBanned,PlayerName(playerid),reason,time); 
    
ShowPlayerDialog(playerid,DIALOG_BANNED,DIALOG_STYLE_MSGBOX,"You have been banned!",bannedstring,"Leave",""); 
    return 
Kick(playerid); 

stock CheckBan(playerid

    new 
Query[256],playerIP[16],largestringtwo[256]; 
    
GetPlayerIp(playerid,playerIP,sizeof playerIP); 
    
mysql_format(mysql,Query,sizeof Query,"SELECT * FROM `banlog` WHERE `Name`='%e' OR `pIPBanned`='%e'",PlayerName(playerid),playerIP); 
    
mysql_tquery(mysql,Query,"OnPlayerBanned","i",playerid); 
    
mysql_format(mysql,Query,sizeof Query,"SELECT * FROM `tbanlog` WHERE `Name`='%e' OR `pIPBanned`='%e'",PlayerName(playerid),playerIP); 
    
mysql_tquery(mysql,Query,"OnPlayerTBanned","i",playerid); 
    return 
1

forward OnPlayerTBanned(playerid); 
public 
OnPlayerTBanned(playerid

    if(
cache_num_rows()) 
    { 
        new 
timeget cache_get_field_content_int(0,"pTBanEnd",mysql); 
        if(
gettime() < timeget
        { 
            new 
string[145]; 
            
format(string,sizeof string,"You are banned for another %i minutes!",timeget-gettime()); 
            return 
SendClientMessage(playerid,-1,string),Kick(playerid); 
        } 
        
mysql_format(mysql,Query,sizeof Query,"DELETE FROM `tbanlog` WHERE `Name`='%e'",PlayerName(playerid)); 
        
mysql_tquery(mysql,Query,"",""); 
    } 
    return 
1

Okk Hello
This is my script of temporary ban system
I am try to create the tBanEnd but it is not working

The tBanEnd ggot created as 0

What is wrong ?

Here is and the photo of my structure



But the tBanEnd stay 0

Thank you

EDIT:
An phooto of save also:



Please help meee fast
THank you
Reply


Messages In This Thread
Temp Ban Command Mysql [+REP] - by arlindi - 25.04.2015, 09:15
Re: Temp Ban Command Mysql [+REP] - by Jimmy0wns - 25.04.2015, 09:17
Re: Temp Ban Command Mysql [+REP] - by Sledgehammer - 25.04.2015, 09:17
Re: Temp Ban Command Mysql [+REP] - by arlindi - 25.04.2015, 09:23
Re: Temp Ban Command Mysql [+REP] - by Mencent - 25.04.2015, 09:33
Re: Temp Ban Command Mysql [+REP] - by arlindi - 25.04.2015, 09:45
Re: Temp Ban Command Mysql [+REP] - by Mencent - 25.04.2015, 09:48
Re: Temp Ban Command Mysql [+REP] - by arlindi - 25.04.2015, 09:56
Re: Temp Ban Command Mysql [+REP] - by Mencent - 25.04.2015, 10:23
Re: Temp Ban Command Mysql [+REP] - by arlindi - 25.04.2015, 12:36

Forum Jump:


Users browsing this thread: 1 Guest(s)