Architekt of Deztruktion Posted January 22, 2013 Posted January 22, 2013 (edited) Hello. Before everything, i must say that i'm a newbie on scripts. (in this language, english, too XD ) So, what am i trying to do? I wanna a npc who says how much times u have logged in. But i'm newbie, so i take a different script as source for this job. And thats is the result: -- dispbottom "You already logged ""query_sql ("SELECT `logincount` FROM `login` WHERE `account_id`=" + getcharid(3) + "", .@lip$);"" times."; -- But something on this line is wrong, must have the ; but it is there. And, if that script is wrong, you're free to correct/teach me. Help me please. XD Edited January 22, 2013 by jivagotupa Quote
Nipsino Posted January 22, 2013 Posted January 22, 2013 (edited) Instead of going the MySQL way, I've created something easier for you. - script LoginCount -1,{ OnPCLoginEvent: set LoginCount,LoginCount+1; dispbottom "You have logged in "+LoginCount+" times!"; end; } Oh! Forgot about the login count. Hold on, I'll try it right now. Try this one - script LoginCount -1,{ query_sql "SELECT `logincount` FROM `login` WHERE `account_id` = '"+getcharid(3)+"'",@login; dispbottom "You have logged in "+@login+" times."; end; } Edited January 22, 2013 by Nipsino Quote
Architekt of Deztruktion Posted January 22, 2013 Author Posted January 22, 2013 I'll try, thanks. It does not work man. :/ Everytime it shows 0 on logincount I'll be my specific about my objective. I'm trying to do a script that will give a item to a newbie, on his first login. But, after that, it will show then how many times he logged in and another things that does not matter now. I try this one: query_sql "SELECT `logincount` FROM `login` WHERE `account_id` = '"+getcharid(3)+"'",@login; OnPCLoginEvent: if ("@login" <1) goto novo; dispbottom "Você já logou "+@login+" vezes."; end; novo: getitem 607,1; dispbottom "Você já logou "+@login+" vezes."; end; and this OnPCLoginEvent: set LoginCount,LoginCount+1; if ("+LoginCount+" <1) goto novo; dispbottom "You have logged in "+LoginCount+" times!"; end; novo: mes "oi"; close; Both of them shows 0 on the login count every time. Somebody know what is us mistake? sry by my english XD Quote
nanakiwurtz Posted January 23, 2013 Posted January 23, 2013 OnPCLoginEvent: set LoginCount,LoginCount+1; if (LoginCount <2) {getitem 501,500;mes "I'll give you 50 Red Potions!";close;} dispbottom "You have logged in "+LoginCount+" times!"; end; 1 Quote
Architekt of Deztruktion Posted January 23, 2013 Author Posted January 23, 2013 It works nana, thanks so much! Quote
Emistry Posted January 23, 2013 Posted January 23, 2013 actually you dont need a new variable...the server itself already got record for it. query_sql( "SELECT `logincount` FROM `login` WHERE `account_id` ='"+getcharid(3)+"'",.@logincount ); dispbottom "You have logged in "+.@logincount+" times."; Quote
Question
Architekt of Deztruktion
Hello.
Before everything, i must say that i'm a newbie on scripts. (in this language, english, too XD )
So, what am i trying to do?
I wanna a npc who says how much times u have logged in.
But i'm newbie, so i take a different script as source for this job.
And thats is the result:
--
dispbottom "You already logged ""query_sql ("SELECT `logincount` FROM `login` WHERE `account_id`=" + getcharid(3) + "", .@lip$);"" times.";
--
But something on this line is wrong, must have the ; but it is there.
And, if that script is wrong, you're free to correct/teach me.
Help me please. XD
Edited by jivagotupa5 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.