Закрыть Привет! Если вы читаете это - Вы еще не зарегистрированы. Это займет не больше минуты. Нажмите здесь, чтобы пройти регистрацию в несколько простых шагов, чтобы пользоваться всеми возможностями нашего форума. Обратите внимание, запрещены непристойные, матерные, бессмысленные (цифры, случайный набор букв) ники. Удачи!

Реклама






 

Lost Role Play ЛЕГЕНДА возвратилась! (Срочно нужны скриптеры оплата присутствтует)
Эти парни доказали качественность своих прогнозов! Зарабатывай с нами!

500р
Маленький баннер400р/мес(Статический показ)
,400рТекстовая реклама300р/мес(Статический показ)
Большой баннер статический
1200р 1000/мес

Внимание ЦЕНЫ СНИЖЕНЫ!!!
Писать по поводу рекламы VK: vk.com/sergey68

** Как получить V.I.P --> КЛИК **

Тема: Продажа всех домов на MySQL

Показано с 1 по 3 из 3

Страница 1 из
  1. #1
    Зарегистрированый

    Аватар для trevison123

    Статус: Оффлайн
    Регистрация:03.01.2018
    Сообщений:1
    Репутация:0 [+/-] 

    Продажа всех домов на MySQL

    Я хочу делать команду которая будет продавать совершенно все дома на DC_CMD ну и mysql.
    Вот так выглядит таблица домов.

    Открыть спойлер

    CREATE TABLE IF NOT EXISTS `housetest` (
    `hID` int(11) NOT NULL AUTO_INCREMENT,
    `hEntrx` float NOT NULL,
    `hEntry` float NOT NULL,
    `hEntrz` float NOT NULL,
    `hExitx` float NOT NULL,
    `hExity` float NOT NULL,
    `hExitz` float NOT NULL,
    `hOwner` varchar(32) NOT NULL DEFAULT 'The State',
    `hDiscript` int(11) NOT NULL,
    `hPrice` int(11) NOT NULL,
    `hOplata` int(11) NOT NULL,
    `hLock` int(11) NOT NULL,
    `hHeal` int(11) NOT NULL,
    `hCarx` float NOT NULL,
    `hCary` float NOT NULL,
    `hCarz` float NOT NULL,
    `hCara` float NOT NULL,
    `Arendator0` varchar(32) NOT NULL DEFAULT 'The State',
    `Arendator1` varchar(32) NOT NULL DEFAULT 'The State',
    `Arendator2` varchar(32) NOT NULL DEFAULT 'The State',
    `Arendator3` varchar(32) NOT NULL DEFAULT 'The State',
    `Arendator4` varchar(32) NOT NULL DEFAULT 'The State',
    `gRentStatus` int(10) NOT NULL DEFAULT '1',
    `RentStatus0` int(10) NOT NULL DEFAULT '0',
    `RentStatus1` int(10) NOT NULL DEFAULT '0',
    `RentStatus2` int(10) NOT NULL DEFAULT '0',
    `RentStatus3` int(10) NOT NULL DEFAULT '0',
    `RentStatus4` int(10) NOT NULL DEFAULT '0',
    `hDays` int(10) NOT NULL DEFAULT '0',
    `RentAllPlata` int(11) NOT NULL DEFAULT '20000',
    `RentPlata0` int(11) NOT NULL DEFAULT '100',
    `RentPlata1` int(11) NOT NULL DEFAULT '100',
    `RentPlata2` int(11) NOT NULL DEFAULT '100',
    `RentPlata3` int(11) NOT NULL DEFAULT '100',
    `RentPlata4` int(11) NOT NULL DEFAULT '100',
    `houseA` float NOT NULL,
    `improve` varchar(9) NOT NULL DEFAULT '0|0|0|0',
    `gun` varchar(64) NOT NULL DEFAULT '0|0|0|0|0|0|0|0|0',
    `skin` varchar(20) NOT NULL DEFAULT '0|0|0',
    `safecode` int(11) NOT NULL DEFAULT '0',
    `safemoney` int(11) NOT NULL DEFAULT '0',
    `drugs` int(11) NOT NULL DEFAULT '0',
    `hFamily` int(11) NOT NULL DEFAULT '0',
    `hFamilyCode` varchar(32) NOT NULL,
    `gHouseFurniture0` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture1` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture2` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture3` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture4` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture5` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture6` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture7` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture8` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture9` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture10` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture11` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture12` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture13` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture14` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture15` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture16` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture17` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture18` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture19` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture20` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture21` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture22` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture23` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture24` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture25` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture26` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture27` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture28` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    `gHouseFurniture29` varchar(64) NOT NULL DEFAULT '0,0.00,0.00,0.00,0.00,0.00,0.00',
    PRIMARY KEY (`hID`)
    ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1131 ;
    [Скрыть]

    Вот так выглядит команда продажи одного дома
    PHP код:
    CMD:asellhome1(playeridparams[])
    {
        if(
    p_info[playerid][pAdmin] < 12) return 1;
        new 
    houseid;
        if(
    sscanf(params,"i",houseid)) return SendClientMessage(playerid, -1"/asellhome [houseid]");
        if(
    houseid || houseid >= TotalHouse) return 1;
        if(!
    strcmp(gHouses[houseid][houseOwner],"The State")) return SendClientMessage(playerid, -1"Этот дом уже продан.");

        
    mysql_query_string[0] = EOS;
        
    format(mysql_query_string144"UPDATE `housetest` SET `hOwner` = 'The State' WHERE `hID` = '%d' LIMIT 1"gHouses[houseid][hID]);
        
    mysql_pquery(connects,mysql_query_string);

        
    format(mysql_query_string144"UPDATE `accounts` SET `pPhousekey` = '0', `pHouseCash` = '%d' WHERE `tName` = '%s' LIMIT 1"gHouses[houseid][hValue]/10gHouses[houseid][houseOwner]);
        
    mysql_pquery(connects,mysql_query_string);

        new 
    playeridd GetPlayerID (  gHouses[houseid ][houseOwner] ) ;
        if ( 
    playeridd != INVALID_PLAYER_ID )
        {
            
    p_info[playeridd][pHouse] = 0;

            
    format(mysql_query_string144"Ваш дом был продан администатором: %s"NamePlayer[playerid]);
            
    SCM(playeriddCBADINFOmysql_query_string);
        }

        
    gHouseshouseid ][hHel] = 0;
        
    gHouseshouseid ][hLock] = 1;
        
    strmid(gHouseshouseid ][houseOwner], "The State"0strlen("The State"), 31);

        
    UpdateHome(houseid);
        
    SaveHome(houseid);

        
    stringer[0] = EOS;
        
    format(stringer68"%s продал дом номер %d"NamePlayer playerid ], houseid ) ;
        
    WriteLog(TYPE_LOG_ASELLHOMEstringer);

        return 
    1;

    Последний раз редактировалось trevison123; 13.01.2018 в 15:38. Причина: добавил допольнительную информацию
  2. #2
    •Профик•

    Аватар для Salery

    Статус: Оффлайн
    Регистрация:27.11.2016
    Сообщений:269
    Репутация:342 [+/-] 
    PHP код:
    CMD:asellhome1(playeridparams[])
    {
        new 
    houseid =1;
        for(new 
    iTotalHouse++)
        {
            if(!
    strcmp(gHouses[houseid][houseOwner],"The State")) continue; 

            
    mysql_query_string[0] = EOS;
            
    format(mysql_query_string144"UPDATE `housetest` SET `hOwner` = 'The State' WHERE `hID` = '%d' LIMIT 1"gHouses[houseid][hID]);
            
    mysql_pquery(connects,mysql_query_string);

            
    format(mysql_query_string144"UPDATE `accounts` SET `pPhousekey` = '0', `pHouseCash` = '%d' WHERE `tName` = '%s' LIMIT 1"gHouses[houseid][hValue]/10gHouses[houseid][houseOwner]);
            
    mysql_pquery(connects,mysql_query_string);

            
    gHouseshouseid ][hHel] = 0;
            
    gHouseshouseid ][hLock] = 1;
            
    strmid(gHouseshouseid ][houseOwner], "The State"0strlen("The State"), 31);

            
    UpdateHome(houseid);
            
    SaveHome(houseid);
            
    houseid ++;
        }
            for(new 
    dMAX_PLAYERS++)
            {
                if ( 
    != INVALID_PLAYER_ID )
                {
                
    p_info[d][pHouse] = 0;
                
    SCM(d"Ваш дом был продан администатором"mysql_query_string);
                }
            }
        return 
    1;

    Последний раз редактировалось Salery; 13.01.2018 в 15:35.
  3. 1 пользователь сказал cпасибо Salery за это полезное сообщение:

    -Enot (14.01.2018)

  4. #3
    •Профик•

    Аватар для Salery

    Статус: Оффлайн
    Регистрация:27.11.2016
    Сообщений:269
    Репутация:342 [+/-] 
    params[] в DC_CMD, ZCMD, PAWN.CMD это стандартный параметр, что он есть, что его нет в команде, это не играет роли
  5. 1 пользователь сказал cпасибо Salery за это полезное сообщение:

    -Enot (14.01.2018)

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения