Jump to content
  • 0

[Basic-to-experts] Ways to call a "function" in another npc.


Tales

Question


  • Group:  Members
  • Topic Count:  163
  • Topics Per Day:  0.04
  • Content Count:  319
  • Reputation:   8
  • Joined:  02/05/12
  • Last Seen:  



- script DualControl -1,{
if ((query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE login.last_ip=(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1", .@account_id) > 1) && ("+getcharid(3)+" != .whiteList)) {


}
OnInit:
.whiteList = 2000000,2000001,2000002,2000003;
}


 

I dont know how can i proceed with this check... i need that this script check a "List" and execute something.

And before I forget... other npcs will call this npcs to execute this "function"... any way to proceed?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


- script DualControl -1,{

OnInit:

bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";// create @test command for the sample

.whiteList$ = "2000000,2000001,2000002,2000003";

end;

OnAtcommand:

.@query_result = query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE "+

"login.last_ip=(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1 and account_id != "+ getcharid(3), .@account_id;

if ( .@query_result > 0 && compare( .whiteList$,getcharid(3) +"" ) == 0 )// not in the list

dispbottom "there is "+ .@query_result +" people with the same ip than you";

end;

}

  • Upvote 1
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:  

Use callfunc and pass along the arguments.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  163
  • Topics Per Day:  0.04
  • Content Count:  319
  • Reputation:   8
  • Joined:  02/05/12
  • Last Seen:  

Ty master, but, what about the "CheckList"? I dont not have any ideia how can i do this

Use callfunc and pass along the arguments.

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:  

Use 'for' and 'if'

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  163
  • Topics Per Day:  0.04
  • Content Count:  319
  • Reputation:   8
  • Joined:  02/05/12
  • Last Seen:  

You open all doors with this tip!
Solved

 

 

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