Jump to content

KoolKat29

Members
  • Posts

    90
  • Joined

  • Last visited

Posts posted by KoolKat29

  1. and if the npc was unloaded, where can you possibly click to load it again?

     

    edit: Oh, it's a reload. sorry  /yawn

     

    or just @reloadnpc <path_to_npc>/npc.txt

     

    will include every npc inside the script includiing the duplicates if the clicking option is client side only.

  2. yoona Yes, I've modified it again. I forgot and I've edited this part :

     query_sql("SELECT last_ip FROM `login` WHERE account_id = "+getcharid(3)+"", .@lastip);
        query_sql("SELECT last_ip, account_id FROM `freebies`", .@freebiesip, .@accid);
     
        if (.@lastip == .@freebiesip) || (.@accid == getcharid(3))
    


    You can try the above post again. 

  3. please post your script. :D

     

    or try this, because the above post is quite messy XD

    prontera,168,184,3	script	Freebies	479,{
        mes .NPC$;
        mes "Wanna get the freebies " +strcharinfo(0)+ "?";
        next;
        if (select("Yes:No") - 1) close;
        mes .NPC$;
        mes "Let me check if you are really a new member";
        next;
    
        query_sql("SELECT last_ip FROM `login` WHERE account_id = "+getcharid(3)+"", .@lastip);
        query_sql("SELECT last_ip, account_id FROM `freebies`", .@freebiesip, .@accid);
    
        if (.@lastip == .@freebiesip) || (.@accid == getcharid(3))
        {
                mes .NPC$;
                mes "You already got the freebies " +strcharinfo(0);
                end;
        }
    
    mes .NPC$; mes "Okay, take these...";
    next;
    
    query_sql("INSERT INTO `freebies` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + escape_sql(getcharip()) + "')");
    
    for ( set .@x,0; .@x < getarraysize(.freebie_item); set .@x,.@x + 1 )
         {
         getitem .freebie_item[.@x], .quantity[.@x];
         }
    end; 
    
    OnInit:
    set .NPC$, "[ " +strnpcinfo(1)+ " ]";
    setarray .freebie_item[0],30316,30315,30314,30027,30028,30029,30030,4302,4403,7227,30499,671,2629,2630,4140;
    setarray .quantity[0],1,1,1,1,1,1,1,1,1,1000,1,1000,2,2,4; waitingroom "Freebies Here",0;
    end;
    } 

     

     

  4. 
    prontera,168,184,3<TAB>script<TAB>Freebies<TAB>479,{
    mes .NPC$;
    mes "Wanna get the freebies " +strcharinfo(0)+ "?";
    next;
    if (select("Yes:No") - 1) close;
    mes .NPC$;
    mes "Let me check if you are really a new member";
    next;
    
    query_sql("SELECT last_ip FROM `login` WHERE account_id = "+getcharid(3)+"", .@lastip);
    query_sql("SELECT last_ip, account_id FROM `freebies`", .@freebiesip, .@accid);
    
    if (.@lastip == .@freebiesip) || (.@accid == getcharid(3))
    {
    mes .NPC$;
    mes "You already got the freebies " +strcharinfo(0);
    end;
    }
    
    mes .NPC$; mes "Okay, take these...";
    next;
    
    query_sql("INSERT INTO `freebies` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + escape_sql(getcharip()) + "')"); for ( set .@x,0; .@x < getarraysize(.freebie_item); set .@x,.@x + 1 )
    {
    getitem .freebie_item[.@x], .quantity[.@x];
    }
    end; 
    
    OnInit:
    set .NPC$, "[ " +strnpcinfo(1)+ " ]";
    .freebie_item[0],30316,30315,30314,30027,30028,30029,30030,4302,4403,7227,30499,671,2629,2630,4140; setarray .quantity[0],1,1,1,1,1,1,1,1,1,1000,1,1000,2,2,4; waitingroom "Freebies Here",0;
    end;
    }
    
    

     

    It duplicates because you dont have an account ID check. it wont really insert not unless you'll use "update".
     
    I assume that your player have changed IP, so he/she was able to get another freebie item, unfortunately, his/her account_id was already registered. That's why it produced an error for duplicating  an existing row using the account id which is your freebie's primary key.
     
    And also try this sql
     
    CREATE TABLE IF NOT EXISTS `freebies` (
      `id` int(11) NOT NULL auto_increment,
      `account_id` int(11) NOT NULL default '0',
      `name` varchar(23) NOT NULL default '',
      `last_ip` varchar(15) NOT NULL,
      PRIMARY KEY (`account_id`),
      KEY (`id`)
    ) ENGINE=MyISAM;
    

    --------------------------------------------------------------------------------------------------------

     

    And BTW, this:

    query_sql("INSERT INTO `freebies` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + .@lastip + "')"); 

    will only save the first numbers before the period. Like for example "127.0.0.1", it will only save "127"

     

    So I Suggest you to use this instead:

    query_sql("INSERT INTO `freebies` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + escape_sql(getcharip()) + "')");
  5. You can use Sir Emistry's Refine Function Script +  from other working Derefiner script

     

    http://pastebin.com/raw.php?i=g8W9yhSs

    prontera,79,129,5    script    test    757,{
    mes "Refiner and Refine Remover";
    next;
    switch (select("+1 Refiner","Refine Remover"))
           {
    case 1:
                mes "Which equipment you want to refine ?";
                mes "make sure you have equipped the items and at least 1 Lotto Ball No.4.";
                next;
                callfunc( "RefineFunc",7364 ,1,63,0,10,1,0,100 );
                end;
    case 2:
                setarray .@ItemID[0],7363,1;
                mes "Which equipment you want to reomove the refine?";
                mes "make sure you have equipped the items and at least 1 Lotto Ball No.3.";
                next;
                if( countitem( .@ItemID[0] ) >= .@ItemID[1] ){
                       for( set .@i,1; .@i <= 10; set .@i,.@i + 1 )
                        set .@Menu$,.@Menu$ + (( getequipid(.@i) > 0 && getequiprefinerycnt(.@i) )? getitemname(getequipid(.@i)):"" )+":";
                        set .@i,select(.@Menu$);
                        setarray .@GetData[0],getequipid(.@i),getequipcardid(.@i,0),getequipcardid(.@i,1),getequipcardid(.@i,2),getequipcardid(.@i,3);
                        failedrefitem .@i;
                        delitem .@ItemID[0],.@ItemID[1];
                        getitem2 .@GetData[0],1,1,0,0,.@GetData[1],.@GetData[2],.@GetData[3],.@GetData[4];
                        equip .@GetData[0];
                        mes "Done.";
                       }
               end;
            }
            }
    
    • Upvote 1
×
×
  • Create New...