Yoona Posted July 13, 2013 Group: Members Topic Count: 153 Topics Per Day: 0.03 Content Count: 567 Reputation: 18 Joined: 04/15/13 Last Seen: April 21, 2016 Share Posted July 13, 2013 (edited) Now the error is in line 30 =( Edited July 13, 2013 by Yoona Quote Link to comment Share on other sites More sharing options...
KoolKat29 Posted July 13, 2013 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 90 Reputation: 5 Joined: 06/17/12 Last Seen: September 6, 2013 Share Posted July 13, 2013 (edited) 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()) + "')"); Edited July 13, 2013 by KoolKat29 Quote Link to comment Share on other sites More sharing options...
Yoona Posted July 13, 2013 Group: Members Topic Count: 153 Topics Per Day: 0.03 Content Count: 567 Reputation: 18 Joined: 04/15/13 Last Seen: April 21, 2016 Author Share Posted July 13, 2013 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, account_id FROM `login` WHERE account_id = "+getcharid(3)+"", .@lastip,.@accid); query_sql("SELECT last_ip FROM `freebies`", .@freebiesip); if (.@lastip == .@freebiesip && .@accid == getcharid(3)) { mes .NPC$; mes "You already got the freebies " +strcharinfo(0); close; } query_sql("INSERT INTO `freebies` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + .@lastip + "')"); for ( set .@x,0; .@x < getarraysize(.freebie_item); set .@x,.@x + 1 ) { getitem .freebie_item[.@x], .quantity[.@x]; } close; 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; edit: sorry... change this if (.@lastip == .@freebiesip && .@accid == getcharid(3)) to this: if (.@lastip == .@freebiesip || .@accid == getcharid(3)) i got an error at line 26? Quote Link to comment Share on other sites More sharing options...
KoolKat29 Posted July 13, 2013 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 90 Reputation: 5 Joined: 06/17/12 Last Seen: September 6, 2013 Share Posted July 13, 2013 (edited) please post your script. 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; } Edited July 13, 2013 by KoolKat29 Quote Link to comment Share on other sites More sharing options...
Yoona Posted July 13, 2013 Group: Members Topic Count: 153 Topics Per Day: 0.03 Content Count: 567 Reputation: 18 Joined: 04/15/13 Last Seen: April 21, 2016 Author Share Posted July 13, 2013 please post your script. 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, account_id FROM `login` WHERE account_id = "+getcharid(3)+"", .@lastip,.@accid); query_sql("SELECT last_ip FROM `freebies`", .@freebiesip); 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; } now its error in line 30 =( it says " parse_line: expect command, missing function name or calling undeclared dunction " Quote Link to comment Share on other sites More sharing options...
KoolKat29 Posted July 13, 2013 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 90 Reputation: 5 Joined: 06/17/12 Last Seen: September 6, 2013 Share Posted July 13, 2013 (edited) 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. Edited July 13, 2013 by KoolKat29 Quote Link to comment Share on other sites More sharing options...
Yoona Posted July 13, 2013 Group: Members Topic Count: 153 Topics Per Day: 0.03 Content Count: 567 Reputation: 18 Joined: 04/15/13 Last Seen: April 21, 2016 Author Share Posted July 13, 2013 (edited) 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. still the same error =( " parse_line: expect command, missing function name or calling undeclared function " Edited July 13, 2013 by Yoona Quote Link to comment Share on other sites More sharing options...
KoolKat29 Posted July 13, 2013 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 90 Reputation: 5 Joined: 06/17/12 Last Seen: September 6, 2013 Share Posted July 13, 2013 (edited) http://pastebin.com/KwmTHpTd I just forgot to put back the setarray for your item list. Edited July 13, 2013 by KoolKat29 Quote Link to comment Share on other sites More sharing options...
eboni001 Posted July 13, 2013 Group: Members Topic Count: 79 Topics Per Day: 0.02 Content Count: 327 Reputation: 4 Joined: 06/22/13 Last Seen: November 13, 2016 Share Posted July 13, 2013 Now the error is in line 30 =( try this one, im using it and is working very good, easy to edit and it will give freebies only once per account: //============================================ //= Npc that gives freebies to the new //============================================ //= Rewritten by SkittleNugget (rAthena.org) //============================================ prontera,146,161,6 script Novice Support 893,{ if( #PlayerRecievedFreebies ) { mes "[Lisa]"; emotion e_swt2; mes "You already claimed your free items or you are not a novice anymore, Remember that i'll give you some free stuffs only once per account!"; close; } else if ( Class < 1 ) { mes "[Lisa]"; emotion e_ho; mes "Hello young adventurer and welcome to Kyojin RO"; mes "I can give you some free items to help you grown fast"; mes "Do you want it?"; next; if ( select("You're so kind. Thank you!:Nah~ Im too pro for this!")==2) { mes "[Lisa]"; emotion e_ag; mes "Such a arrogant person."; mes "^ff0000@kill "+ strcharinfo(0) +"^000000"; next; mes "[Lisa]"; emotion e_omg; mes "Why my command not work?!"; mes "Maybe you're lucky!"; close; } mes "[Lisa]"; emotion e_kis; mes "Please take this item and have a nice day~"; next; getitem 504,30; //White Potion getitem 645,25; //Concentration potion getitem 14533,4; //Field Manual getitem 14232,10; //ygg berry box(10) getitem 4142,1; //Doppelganger Card set #PlayerRecievedFreebies, 1; mes "See you soon~"; close; } } Quote Link to comment Share on other sites More sharing options...
Question
Yoona
Now the error is in line 30 =(

Edited by YoonaLink to comment
Share on other sites
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.