Do you mean if someone is using it on the server? Or just if it's possible for someone to use it?For the first one, just loop through all players and check their data blocks. For the second, use if(isObject(%player.getDataBlock()))
for(%i=0;%i<clientGroup.getCount();%i++){ %obj = %clientGroup.getObject(%i).player; if(isObject(%obj) && %obj.getDataBlock() $= "YourDataBlockName") //do something}
Good call, Treynolds. How about if there's no player using a given datablock? What should I do for that?
function someoneIsUsingThisDataBlock(%datablock){ for(%i=0;%i<clientGroup.getCount();%i++) { %obj = %clientGroup.getObject(%i).player; if(isObject(%obj) && %obj.getDataBlock() $= "%datablock") return true; } return false;}
What do you mean? What do you want to happen if it's the playertype you're looking for, and what do you want to have happen if nobody is using it? You can also separate this into a different function, like this:Code: [Select]function someoneIsUsingThisDataBlock(%datablock){ for(%i=0;%i<clientGroup.getCount();%i++) { %obj = %clientGroup.getObject(%i).player; if(isObject(%obj) && %obj.getDataBlock() $= "%datablock") return true; } return false;}And you can then use lines like if(someoneIsUsingThisDataBlock("dataBlockName")) or if(!someoneIsUsingThisDataBlock("dataBlockName"))
Umm, shouldn't the %datablock in if(isObject(%obj) && %obj.getDataBlock() $= "%datablock") not be in quotes?
What the **** do you thinkHe isn't that bad at scripting, you don't need to try to pick out every little thing that isn't exactly perfect in an obvious example. This isn't the first time I've seen you do something like this.
: /Never try pointing out mistakes, it just gets people angry.
this is surprisingly irrational from treynolds... he's usually good about something like that.