Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-26-2002, 04:46 PM
BBflat BBflat is offline
Registered User
BBflat's Avatar
Join Date: Apr 2002
Location: United States of America
Posts: 573
BBflat is on a distinguished road
playerindex

Gah, help, I can't get the index of other players! testplayer(x,y) works great to get MY index which will always be 0, but it doesn't get anybody else's index. What do I need to do to get somebody else's index?? Sorry about all these questions lately.
__________________
I am a .sig virus. Please put me in your .sig so I can continue to replicate.
Reply With Quote
  #2  
Old 05-27-2002, 04:04 AM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Re: playerindex

Quote:
Originally posted by BBflat
Gah, help, I can't get the index of other players! testplayer(x,y) works great to get MY index which will always be 0, but it doesn't get anybody else's index. What do I need to do to get somebody else's index?? Sorry about all these questions lately.
The way I like to do it is like this:
NPC Code:

if (playerchats && startswith(/get , #c)) {
this.player = -1;
for ( i=0; i<playerscount; i++ ) {
if (strequals(#a(i), #e(5,-1,#c))) {this.player = i; i=playerscount;}
}
if (this.player == -1)
setplayerprop #c, the player is not on the level;
else
setplayerprop #c, the player's index if #v(this.player);
}



The way this works is the player says: "/get <account>" and if the player is on the level it returns their index. There are many ways to get indexes though, like useing mouse vars you can use an in with a for loop...
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.