Jump to content
  • 0

Not Entering For Loop


benching

Question


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  350
  • Reputation:   43
  • Joined:  09/07/12
  • Last Seen:  

I'm trying to add/check the player ip into an array,
but my script is not behaving as it is intended.

The issue here is that, its not running the for loop,
tried to add some debug messages to make sure of it.

OnInit:
	setarray .@iparr$[0],"null";
end;

OnPCLoginEvent:

	query_sql("SELECT `last_ip` FROM `login` WHERE `account_id` = '"+getcharid(3)+"'",@pip$);

	set .@arrsize,getarraysize(.@iparr$);
	for(set .@i,0; .@i < .@arrsize; set .@i,.@i+1) {
		//do things
		// for debugging purposes
		dispbottom "index "+.@i+" with value of "+@pip$+"";
	}
		// for debugging purposes
		dispbottom "pc login loop done";
end;

Someone please check this for me,
this is kind of frustrating, (i always was)

Is it because of my variable types? ( i dont think so)
Is this a Bug or something else?

Edited:
found out that the getarraysize() function has something to do with this,
i'm not sure why, ill just find other way, instead of using getarraysize().

Edited by benching
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

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

use npc scope variable to define your array.

setarray .iparr$,"null";
.@arrsize = getarraysize( .iparr$ );
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...