oban command
#10

PHP код:
COMMAND:oban(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
        if(
playerData[playerid][playerLevel] >= 4)
        {
            new 
otherPlayer[24], reason[50];
            if(
sscanf(params"s[24]s[50]"otherPlayerreason)) return SendClientMessage(playerid, -1"{FF0000}[ERROR] {FFFFFF}Usage: /oban <playername> <reason>");
            {
                new 
mysql[150], value[100][50], row[200];
                
format(mysqlsizeof(mysql), "SELECT * FROM `playerdata` WHERE `playerName` = '%s'"otherPlayer);
                
mysql_query(mysql);
                
mysql_store_result();
                if(
mysql_num_rows())
                {
                    
mysql_fetch_row(row"|"connection);
                     
explode(rowvalue"|");
                    
mysql_fetch_row(value[4], "playerIP");
                    new 
str[150];
                    
format(strsizeof(str), "SELECT * FROM `playerbans` WHERE `player_banned` = '%s'"otherPlayer);
                    
mysql_query(str);
                    
mysql_store_result();
                    if(
mysql_num_rows())
                    {
                        
SendClientMessage(playerid, -1"{FF0000}[ERROR]{FFFFFF} This player is already banned.");
                        
mysql_free_result();
                    }
                    else
                    {
                        new 
banreason[350], msg[250], msg1[250];
                        
format(banreasonsizeof(banreason), "INSERT INTO `playerbans` (`banned_by`, `banned_for`, `player_banned`, `player_ip`) VALUES ('%s', '%s', '%s', '%s')"GetName(playerid), reasonotherPlayerplayerIP);
                        
mysql_query(banreason);
                        
format(msgsizeof(msg), "{33AA33}[ADMIN] Adminstrator %s(%i) has offline banned %s. {FFFF00}[REASON: %s]"GetName(playerid), playeridotherPlayerreason);
                        
SendClientMessageToAll(-1msg);
                        
format(msg1sizeof(msg1), "{33AA33}[ADMIN]{FFFFFF} You've offline banned %s for %s."otherPlayerreason);
                        
SendClientMessage(playerid, -1msg1);
                        
mysql_free_result();
                    }
                    
mysql_free_result();
                }
                else
                {
                    
SendClientMessage(playerid, -1"{FF0000}[ERROR]{FFFFFF} That player doesn't exist in the database.");
                }
            }
        }
        else
        {
            
SendClientMessage(playerid, -1"{FF0000}[ERROR]{FFFFFF} You're not authorized to use this command.");
        }
    }
    else
    {
        
SendClientMessage(playerid, -1"{FF0000}[ERROR] {FFFFFF}You must be logged in to use commands.");
    }
    return 
1;

Quote:

format(banreason, sizeof(banreason), "INSERT INTO `playerbans` (`banned_by`, `banned_for`, `player_banned`, `player_ip`) VALUES ('%s', '%s', '%s', '%s')", GetName(playerid), reason, otherPlayer, playerIP);

Reply


Messages In This Thread
oban command - by mmostafa - 03.06.2018, 13:19
Re: oban command - by SeanDenZYR - 03.06.2018, 13:46
Re: oban command - by mmostafa - 03.06.2018, 19:34
Re: oban command - by mmostafa - 03.06.2018, 22:50
Re: oban command - by insus100 - 04.06.2018, 00:01
Re: oban command - by GTLS - 04.06.2018, 05:13
Re: oban command - by mmostafa - 04.06.2018, 17:27
Re: oban command - by Stev - 04.06.2018, 17:42
Re: oban command - by mmostafa - 04.06.2018, 17:47
Re: oban command - by mmostafa - 04.06.2018, 17:51

Forum Jump:


Users browsing this thread: 1 Guest(s)