Jump to content
  • 0

Login count on npc.


Architekt of Deztruktion

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  10/08/12
  • Last Seen:  

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. :D

Help me please. XD

Edited by jivagotupa
Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  218
  • Reputation:   16
  • Joined:  01/24/12
  • Last Seen:  

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 by Nipsino
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  10/08/12
  • Last Seen:  

I'll try, thanks. :D

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

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;

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

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.";

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...