viewing paste Unknown #22150 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
// .----------------------------------------------------------.
// .            SoulBlaker Scripts Apresenta:             .
// .            ___________________               .
// .           /   _____/\______   \                      .
// .           \_____  \  |    |  _/              .
// .           /        \ |    |   \              .
// .          /_______  / |______  /              .
// .              \/         \/                   .
// .            [ Cronus Advanced Scripts ]                   .
// .                            v1.0  .
// .----------------------------------------------------------.
// ; http://cronus-emulator.com/forum/index.php?showuser=3261 ;
// .----------------------------------------------------------.
// . Script:                                                  .
// .  Kafra Staff de CashAdmin                          .
// .----------------------------------------------------------.
// . Por: SoulBlaker   Compátivel: Cronus SQL   versão: 1.0  .
// .----------------------------------------------------------.
// . Descrição:                                               .
// .  Adiciona/Remove Pontos dos Jogadores InGame, sem preci- .
// .  do Jogador estiver Online.                              .
// .                                                          .
// .  Se o Registro de váriavel não existir, o npc mesmo cria,.
// .  OBS: Recomendável utilizar sempre primeiramente o       .
// .       Comando de Cash no Jogador antes de manusear no    .
// .       NPC.                                               .
// .                                  .
// . Adiciona/Remove ou Muda Preços dos Itens do CashShop.    .
// .----------------------------------------------------------.
// . Changelog da Versão:                                     .
// .   - 1.0 Iniciado o NPC. [SoulBlaker]                     .
// *----------------------------------------------------------*
/*
 
#
# Table structure for table `kafra_cashadmin`
# Version: 1.0  by SoulBlaker
#
 
DROP TABLE IF EXISTS `kafra_cashadmin`;
CREATE TABLE `kafra_cashadmin` (
  `id` smallint(5) unsigned NOT NULL default '0',
  `name` varchar(50) NOT NULL default '',
  `price` mediumint(10) unsigned default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;
 
 
*/
 
 
 
prontera,168,187,4  script  Kafra Staff#cashs1  117,{
 
    function Query;
    function RelodDataBase;
    cutin "kafra_01",2;
    if( GetGmLevel() < 99 )
    {
        mes "^0000CD[ Kafra Staff ]^000000";
        mes "Hello ^FF0000" + StrCharInfo(0) + "^000000,";
        mes "What do you want?";
        next;
        Switch( Select("- Check points","- Open CashShop","- Cancel" ) )
        {
            case 1:
                set .@Result, Query("Select",GetCharId(3));
                mes "^0000CD[ Kafra Staff ]^000000";
                mes "You got a total amount of: ^FF0000" + .@Result + " points^000000.";
                break;
            case 2:
                mes "^0000CD[ Kafra Staff ]^000000";
                mes "Good shopping!";
                close2;
                callcashshop "Kafra Staff#cashs2";
                cutin "",255;
                end;
            case 3:
                mes "^0000CD[ Kafra Staff ]^000000";
                mes "Very well then.";
                break;
        }
    }
    else {
        mes "^0000CD[ Kafra Staff ]^000000";
        mes "Welcome admin,";
        mes "what do you want?";
        next;
        Switch( Select("- Check points","- Add or Remove points","- Add or Remove Items from shop","- Open CashShop","- Cancel") )
        {
            case 1:
                mes "^0000CD[ Kafra Staff ]^000000";
                mes "Please, insert the Account ID that you want to check.";
                next;
                input .@AccountID;
                set .@Consult$, Query("Check",.@AccountID);
                if( .@Consult$ == "" )
                {
                    mes "^0000CD[ Kafra Staff ]^000000";
                    mes "It doesn't exists!";
                }
                else {
                    set .@Result,Query("Select",.@AccountID);
                    mes "^0000CD[ Kafra Staff ]^000000";
                    mes "^FF0000Account:^000000 "+.@AccountID;
                    mes " ";
                    mes "^FF0000Total amount:^000000 "+.@Result;
                }
                break;
            case 2:
                mes "^0000CD[ Kafra Staff ]^000000";
                mes "Please, insert the Account ID";
                next;
                input .@AccountID;
                set .@Consult$, Query("Check",.@AccountID);
                if( .@Consult$ == "" )
                {
                    mes "^0000CD[ Kafra Staff ]^000000";
                    mes "It doesn't exists!";
                    mes " ";
                    mes "^FF0000Make sure that you have added some cash manually to it first!";
                    mes "Or you can add a register right now^000000";
                    mes " ";
                    mes "Do you want to proceed?";
                    next;
                    if( Select("- Yes","- Cancel") == 1 )
                    {
                        Query("Create",.@AccountID);
                        set .@Again,Query("Select",.@AccountID);
                        if( .@Again )
                        {
                            // it is not going to happen, so I'm not going to translate xD
                            mes "^0000CD[ Kafra Staff ]^000000";
                            mes "Houve algum erro ao Registrar a Conta " + .@AccountID + ".";
                            mes " ";
                            mes "Por favor, reporte ao criador do Script 'SoulBlaker'.";
                            debugmes "Erro ao Registrar a Conta " + .@AccountID + " na tabela de registro de váriaveis global, reporte ao membro '[SoulBlaker]' do fórum eAthena.";
                        }
                        else {
                            mes "^0000CD[ Kafra Staff ]^000000";
                            mes "Very well, Account ^FF0000" + .@AccountID + "^000000 registered with success.";
                        }
                    }
                    else {
                        mes "^0000CD[ Kafra Staff ]^000000";
                        mes "blablabla not needed xD";
                    }
                }
                else {
                    set .@Result, Query("Select",.@AccountID);
                    mes "^0000CD[ Kafra Staff ]^000000";
                    mes "Insert the amount of points that you want to Add or Remove";
                    mes " ";
                    mes "^FF0000Current amount: " + .@Result + "^000000.";
                    mes " ";
                    next;
                    input .@Amount;
                    if( .@Amount == 0 )
                    {
                        mes "^0000CD[ Kafra Staff ]^000000";
                        mes "You need to insert a value higher than zero.";
                        
                    }
                    else {
                        mes "^0000CD[ Kafra Staff ]^000000";
                        mes "Do you want to remove or add those points?";
                        next;
                        set .@Type,Select("- Add.","- Remove.");
 
                        mes "^0000CD[ Kafra Staff ]^000000";
 
                        if( .@Type == 1 )
                            mes "Would you like to add ^FF0000" + .@Amount + "^000000 points?";
                        else
                            mes "Would you like to remove ^FF0000" + .@Amount + "^000000 points?";
 
                        mes " ";
                        mes "^FF0000Current amount:^000000 " + .@Result + ".";
                        mes " ";
                        if( .@Type == 1 )
                        {
                            set .@Amount, .@Result + .@Amount;
                            mes "^FF0000Amount after:^000000 " + .@Amount + ".";
                        }
                        else {
                            set .@Amount, .@Result - .@Amount;
                            mes "^FF0000Amount after:^000000 " + .@Amount + ".";
                        }
                        next;
                        if( Select("- Confirm.","- Cancel") == 1 )
                        {
                            Query("Update",.@AccountID,.@Amount);
                            set .@Status,Query("Select",.@AccountID);
                            if( .@Type == 1 && .@Status != .@Amount )
                            {
                                mes "^0000CD[ Kafra Staff ]^000000";
                                mes "Me desculpe, mais não foi possível creditar desta conta.";
                            }
                            else if( .@Type == 2 && .@Status != .@Amount )
                            {
                                mes "^0000CD[ Kafra Staff ]^000000";
                                mes "Me desculpe, mais não foi possível remover créditos desta conta.";
                            }
                            else {
                                mes "^0000CD[ Kafra Staff ]^000000";
                                if( .@Type == 1 )
                                    mes "Success!";
                                else
                                    mes "Success!";
                            }
                        }
                        else {
                            mes "^0000CD[ Kafra Staff ]^000000";
                            mes "Very well then.";
                        }
                    }
                }
                break;
            case 3:
                mes "^0000CD[ Kafra Staff ]^000000";
                mes "Muito bem, o que deseja fazer?";
                next;
                set .@Choose, Select("- Adicionar Itens no CashShop.","- Remover Itens no CashShop.","- Mudar Preço de um Item.","- Ver Informações de Itens no CashShop.");
                if( .@Choose == 4 )
                {
                    Query_SQL("SELECT `id`, `name`, `price` FROM `kafra_cashadmin`", .@Consult, .@Name$, .@Price);
                    for( set .@i,0; .@i < GetArraySize(.@Consult); set .@i, .@i + 1 )
                    {
                        mes "^0000FFID:^000000 " + .@Consult[.@i];
                        mes "^0000FFNome:^000000 " + .@Name$[.@i];
                        mes "^0000FFPreço:^000000 " + .@Price[.@i];
                        mes "------------------";
                        mes " ";
                    }
                }
                else {
                    mes "^0000CD[ Kafra Staff ]^000000";
                    mes "Muito bem, digite o id do item";
                    if( .@Choose == 1 )
                        mes "Que deseja Adicionar.";
                    else if( .@Choose == 2 )
                        mes "Que deseja Remover.";
                    else if( .@Choose == 3 )
                        mes "Que deseja Mudar o Preço.";
                    next;
                    input .@ID;
                    if( .@Choose == 1 || .@Choose == 3 )
                    {
                        mes "^0000CD[ Kafra Staff ]^000000";
                        mes "Muito bem, digite o preço do Item.";
                        next;
                        input .@Price;
                    }
                    if( .@Choose == 1 && Query("GetItem",.@ID) )
                    {
                        mes "^0000CD[ Kafra Staff ]^000000";
                        mes "Me desculpe, mais existe um item com";
                        mes "esta ID no CashShop, você deve remover";
                        mes "ou editar seus preços para continuar.";
                    }
                    else if( ( .@Choose == 2 || .@Choose == 3 ) && !Query("GetItem",.@ID) )
                    {
                        mes "^0000CD[ Kafra Staff ]^000000";
                        mes "Me desculpe, mais não existe um item";
                        mes "com esta ID no CashShop.";
                    }
                    else {
                        mes "^0000CD[ Kafra Staff ]^000000";
                        if( .@Choose == 1 )
                            mes "Tem certeza que Deseja Adicionar este item do CashShop?";
                        else if( .@Choose == 2 )
                            mes "Tem certeza que Deseja Remover este item do CashShop?";
                        else if( .@Choose == 3 )
                            mes "Tem certeza que Deseja Mudaro Preço deste item do CashShop?";
                        next;
                        if( Select("- Yes.","- No") == 1 )
                            RelodDataBase(.@Choose,.@ID,.@Price);
                    }
                }
                break;
            case 4:
                mes "^0000CD[ Kafra Staff ]^000000";
                mes "Good shopping!";
                close2;
                callcashshop "Kafra Staff#cashs2";
                cutin "",255;
                end;                
            case 5:
                mes "^0000CD[ Kafra Staff ]^000000";
                mes "I'll be there.";
                break;
        }
    }
    close2;
    cutin "",255;
    end;
 
OnInit:
// InitWaitingRoom Event
    waitingroom "Assistente do CashShop",0;
// InitDB Merchant
    npccashshopdelitem "Kafra Staff#cashs2",501;
    Query_SQL("SELECT `id`, `price` FROM `kafra_cashadmin`",.@ID,.@Price);
    for( set .@i,0; .@i < GetArraySize(.@ID); set .@i, .@i + 1 )
        npccashshopadditem "Kafra Staff#cashs2",.@ID[.@i],.@Price[.@i];
    end;
 
// ReloadDB Merchant
    function    RelodDataBase   {
 
        if( GetArg(0) == 1 )
        {
            Query("SetItem",GetArg(1),GetArg(2));
            if( Query("GetItem",GetArg(1)) )
            {
                debugmes "AID: " + GetCharID(3) + ", CID: " + GetCharID(0) + ", adicionou o item ID " + GetArg(1) + " pelo preço " + GetArg(2) + " no Kafra CashShop Admin.";
                npccashshopadditem "Kafra Staff#cashs2",GetArg(1),GetArg(2);
                dispbottom "Added!";
            }
            else {
                debugmes "AID: " + GetCharID(3) + ", CID: " + GetCharID(0) + ", tentou adicionar o item ID " + GetArg(1) + " pelo preço " + GetArg(2) + " no Kafra CashShop Admin, mais sua tentativa falhou.";
                dispbottom "Error while adding!";
            }
        }
        else if( GetArg(0) == 2 )
        {
            Query("DelItem",GetArg(1));
            if( !Query("GetItem",GetArg(1)) )
            {
                debugmes "AID: " + GetCharID(3) + ", CID: " + GetCharID(0) + ", removeu o item ID " + GetArg(1) + " do Kafra CashShop Admin.";
                npccashshopdelitem "Kafra Staff#cashs2",GetArg(1);
                dispbottom "Removed!";
            }
            else {
                debugmes "AID: " + GetCharID(3) + ", CID: " + GetCharID(0) + ", removeu o item ID " + GetArg(1) + " do Kafra CashShop Admin, mais sua tentativa falhou.";
                dispbottom "Error while removing!";
            }
        }
        else if( GetArg(0) == 3 )
        {
            Query("ReplacePrice",GetArg(1),GetArg(2));
            if( Query("GetPriceInfo",GetArg(1)) == GetArg(2) )
            {
                debugmes "AID: " + GetCharID(3) + ", CID: " + GetCharID(0) + ", mudou o preço do Item ID " + GetArg(1) + " para " + GetArg(2) + " no Kafra CashShop Admin.";
                npccashshopdelitem "Kafra Staff#cashs2",GetArg(1);
                npccashshopadditem "Kafra Staff#cashs2",GetArg(1),GetArg(2);
                dispbottom "Editado com sucesso, reiniciando item... posto no final da lista de compras.";
            }
            else {
                debugmes "AID: " + GetCharID(3) + ", CID: " + GetCharID(0) + ", tried to change the price of Item ID " + GetArg(1) + " to " + GetArg(2) + " in the Kafra CashShop Admin, but failed.";
                dispbottom "Error while editing item.";
            }
        }
        return;
    }
 
// Query Result
    function    Query   {
 
        if( GetArg(0) == "Select" )
        {
            Query_SQL "SELECT `value` FROM `global_reg_value` WHERE `str`='#CASHPOINTS' AND `account_id`='"+ GetArg(1) +"'", .@Consult;
            return (.@Consult);
        }
        else if( GetArg(0) == "Update" )
        {
            Query_SQL "UPDATE `global_reg_value` SET `value`="+ GetArg(2) +" WHERE `str`='#CASHPOINTS' AND `account_id`='"+ GetArg(1) +"'";
            return;
        }
        else if( GetArg(0) == "Create" )
        {
            Query_Sql "INSERT INTO `global_reg_value` VALUES (0, '#CASHPOINTS', 0, 2, " + GetArg(1) + ")";
            return;
        }
        else if( GetArg(0) == "Check" )
        {
            Query_SQL "SELECT `str` FROM `global_reg_value` WHERE `account_id`='" + GetArg(1) + "'", .@Return$;
            return .@Return$;
        }
        else if( GetArg(0) == "SetItem" )
        {
            Query_SQL "INSERT INTO `kafra_cashadmin` VALUES (" + GetArg(1) + ", '" + GetItemName(GetArg(1)) + "', " + GetArg(2) + ")";
            return;
        }
        else if( GetArg(0) == "ReplacePrice" )
        {
            Query_SQL "UPDATE `kafra_cashadmin` SET `price`="+ GetArg(2) +" WHERE `id`='"+ GetArg(1) +"'";
            return;
        }
        else if( GetArg(0) == "DelItem" )
        {
            Query_SQL "DELETE FROM `kafra_cashadmin` WHERE `id`='"+ GetArg(1) +"'";
            return;
        }
        else if( GetArg(0) == "GetItem" )
        {
            Query_SQL "SELECT `id` FROM `kafra_cashadmin` WHERE `id`='"+ GetArg(1) +"'",.@Consult;
            return (.@Consult);
        }
        else if( GetArg(0) == "GetPriceInfo" )
        {
            Query_SQL("SELECT `price` FROM `kafra_cashadmin` WHERE `id`='" + GetArg(1) +"'",.@Consult);
            return (.@Consult);
        }
        else return 0;
    }
}
 
// Floating CashShop
-   cashshop    Kafra Staff#cashs2  -1,501:10
Viewed 1193 times, submitted by Guest.