Looking For Oban Cmd
#2

This is kind of confusing considering "Oban" = Offline ban, but you're not doing any checks too see if the account exists, you're only banning the player if they're online

Do you have an "Accounts Table"?

But maybe something like this?

PHP код:
YCMD:oban(playeridparams[], help) {
    if(
help) {
        
SendClientMessage(playeridX11_WHITE"Bans an offline player");
        return 
1;
    }
    new 
username[(MAX_PLAYER_NAME*2)+1],reason[128];
    if(!
sscanf(params,"s[" #MAX_PLAYER_NAME "]s[128]",username,reason)) {
        
mysql_real_escape_string(usernameusername);
        
format(szquerysizeof(szquery), "SELECT `username` FROM `accounts` WHERE `username` = '%s'",username);
        
mysql_function_query(SQL_Handle_Nameszquerytrue"OfflineBanPlayer""dss",playerid,username,reason);
    } else {
        
SendClientMessage(playeridX11_WHITE"USAGE: /oban [username] [reason]");
    }
    return 
1;
}
forward OfflineBanPlayer(playeridname[],reason[])
public 
OfflineBanPlayer(playeridname[],reason[]) {
    new 
accname[128];
    new 
rowsfields;
    
cache_get_data(rowsfields);
    if(
rows 1) {
        
SendClientMessage(playeridX11_TOMATO_2"* User not found");
        return 
1;
    }
    
cache_get_row(0,0,accname);
    
format(banreasonsizeof(banreason), "INSERT INTO `playerbans` (`banned_by`, `banned_for`, `player_banned`, `player_ip`) VALUES ('%s', '%s', '%s')"adminNamereasonname);
    
mysql_query(banreasonMYSQL_ADD_BANplayeridconnection);
    
format(szquerysizeof(szquery), "[AdmWarn]: %s has OBanned %s: %s",GetPlayerName(playeridaccname), namereason);
    
SendMessageToAdmins(msg);
    return 
1;

Obviously you'll need to change it to match your stuff but that's pretty much the code needed.
I ain't got time to be guessing your table names, an making the whole command for you, so this is just an example of what will work
Reply


Messages In This Thread
Looking For Oban Cmd - by BlackLineCnR - 15.10.2017, 16:29
Re: Looking For Oban Cmd - by Prokill911 - 15.10.2017, 17:08

Forum Jump:


Users browsing this thread: 1 Guest(s)