mysql from r33 to r40
#1

PHP Code:
CMD:tempban(playeridparams[])
{
    new 
banner[MAX_PLAYER_NAME], banned[MAX_PLAYER_NAME], bannedidreason[25], hoursstring[400], secsunbantsip[16], query[180];
    if(!
IsPlayerAdmin(playerid) && pInfo[playerid][playerAdmin] < 2) return SendClientMessage(playeridERROR"You do not have sufficient permissions to use this command."); //this is just my admin check, yours may be different.
    
if(sscanf(params"uds[25]"bannedidhoursreason)) return SendClientMessage(playerid, -1"Usage: /tempban [player name/ID] [hours] [reason]"); // here, we're checking if the administrator entered the command correctly. "u" is a player name or ID, "d" is the amount of hours as an integer, and "s[25]" is the reason.
    
if(!IsPlayerConnected(bannedid)) return SendClientMessage(playerid, -1"Invalid player name/ID."); //checking if the player that the admin is trying to ban is connected to the server
    
if(pInfo[playerid][playerAdmin] < pInfo[bannedid][playerAdmin]) return SendClientMessage(playerid, -1"You cannot ban someone with a higher level than you!"); //I don't allow admins to ban those with higher levels than their own.
    
if(strlen(reason) < || strlen(reason) > 24) return SendClientMessage(playerid, -1"Your reason must be between 3 and 24 characters."); //limiting the reason length to 3-24 characters
    
if(hours 12 || hours 720) return SendClientMessage(playerid, -1"Ban hours are between 12 and 720 hours");
    
GetPlayerName(playeridbannersizeof(banner));
    
GetPlayerName(bannedidbannedsizeof(banned));
    
GetPlayerIp(bannedidipsizeof(ip));
     
secs hours*3600
    unbants 
gettime()+ secs;
    
format(querysizeof(query), "INSERT INTO `bans` (ban_id, player, ip, admin, reason, ban_time, unban_time) VALUES ('0', '%s', '%s', '%s', '%s', %d, %d)",
    
bannedipbannerreasongettime(), unbants);
    
mysql_query(query);
    
format(stringsizeof(string), "You've been temporarily banned.\n\n{FFFFFF}Staff member: %s\nReason: %s"bannerreason);
    
ShowPlayerDialog(bannedid678DIALOG_STYLE_MSGBOX"Banned!"string"Close""");
    
format(stringsizeof(string), "%s(%d) has banned %s(%d) for %d hours for: %s"bannerplayeridbannedbannedidhoursreason);
    
SendClientMessageToAll(-1string);
    
SetTimerEx("KickEx"500falseplayerid"i");
    return 
1;
}
forward KickEx(playerid);
public 
KickEx(playerid)
{
    
Kick(playerid);
    return 
1;
}
forward OnBanCheck(playerid);
public 
OnBanCheck(playerid)
{
    new 
banquery[180], ip[16];
    
GetPlayerIp(playeridip16);
    
format(banquerysizeof(banquery), "SELECT unban_time FROM `bans` WHERE ip = '%s'"ip);
    
mysql_query(banquery);
    
mysql_store_result();
    if(
mysql_num_rows() != 0
    {
        new 
unbantimestamp mysql_fetch_int(); 
        if(
unbantimestamp gettime())
        {
            
SendClientMessage(playerid, -1"You're banned from this server.");
            
SetTimerEx("KickEx"500falseplayerid"i");
        }
    }
    return 
1;

i have this code and i wanna to make it use r40mysql insteand of r33 actually i tried but i dont know how to transfer them
so if someone can help me
Reply


Messages In This Thread
mysql from r33 to r40 - by makemoneynotfriends - 28.06.2020, 11:21
Re: mysql from r33 to r40 - by Kwarde - 28.06.2020, 11:31
Re: mysql from r33 to r40 - by SkyFlare - 28.06.2020, 11:33
Re: mysql from r33 to r40 - by makemoneynotfriends - 28.06.2020, 12:03
Re: mysql from r33 to r40 - by makemoneynotfriends - 28.06.2020, 13:02
Re: mysql from r33 to r40 - by SkyFlare - 28.06.2020, 13:11
Re: mysql from r33 to r40 - by makemoneynotfriends - 28.06.2020, 13:29

Forum Jump:


Users browsing this thread: 1 Guest(s)