View Single Post
  #1  
Old 03-08-2004, 04:48 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
aindexof - serverside

It has come to my attention that aindexof doesn't quite work serverside. When a variable not in the array is questioned, the function returns 0, but it should return -1.
NPC Code:

if (actionserverside) {
this.array = {0,1,2,4};
with (getplayer(#p(0)) setplayerprop #c,#v(aindexof(this.array,3));
}
}
//#CLIENTSIDE
if (keypressed) {
if (keydown2(keycode(c),false)) {
this.array = {0,1,2,4};
setplayerprop #c,#v(aindexof(this.array,3));
}
if (keydown2(keycode(v),false)) {
triggeraction 0,0,weaponname,#a;
}
}


Put this in a weapon script and try it. When you push c, you'll get -1, like you should. But, when you push v, you'll get 0, which is incorrect.
I forum PM'ed Stefan, but I wanted to make this thread to ensure he see's it (and to let others know, I suppose).
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote