Author Topic: Checking players datablock  (Read 1033 times)

Sorry for all the topics i'm new to coding could anyone point me in the direction of checking if players are in any sort of minigame?

Thanks c:

Recycling thread, how would I go about doing this?
« Last Edit: January 03, 2014, 06:15:49 PM by Starzy »

I don't script a lot anymore, but if I remember correctly:
Code: [Select]
if(isObject(%client.minigame))
{
     //If true
}

The code above should return true if the client object "%client" is in a minigame.

Check if %client is in a minigame: isObject(%client.miniGame)
Check if %client is in the default minigame: isObject(%client.miniGame) && %client.miniGame.owner == 0
Iterate over clients in a minigame:

for (%i = 0; %i < %miniGame.numMembers; %i++)
{
    %client = %miniGame.member[%i];
    // ...
}

Check if client is in a minigame:

isObject(getMinigameFromObject(%client));

Check if a minigame is a Slayer minigame:

%minigame.isSlayerMinigame

Wait does slayer count as a normal minigame too? So if(isObject(GetMinigameFromObject(%client))); would it return true if the player was in a default minigame / slayer minigame?



Recycling thread, how would I go about checking? I'm honestly confused :/

%player.getdatablock() will return the ID for the datablock object. So you can use that to get certain datablock values. Like: %player.getdatablock().maxDamage

You can get the name of the datablock too, %player.getdatablock().getname(); --> playerStandardArmor

%player.getdatablock() will return the ID for the datablock object. So you can use that to get certain datablock values. Like: %player.getdatablock().maxDamage

You can get the name of the datablock too, %player.getdatablock().getname(); --> playerStandardArmor
thankkssss

You're probably going to end up doing something like this:

%player.getDataBlock().getName() $= "MyCustomPlayer"

This is an inefficient way of doing it as it uses a string comparison, and, in the rare case of the player not having a datablock, will throw an error. Do this instead:

%player.getDataBlock() == nameToID("MyCustomPlayer")