Blockland Forums > Modification Help
Get player's name color from %obj?
<< < (2/2)
tyler0:
I need a way of showing if a player has a red name (criminal) then output.
Headcrab Zombie:

--- Quote from: lordician on July 19, 2011, 07:36:46 AM ---Do mind that he wants the color off the name, not only the name.

--- End quote ---
Oh, right


--- Quote from: tyler0 on July 19, 2011, 03:01:47 PM ---I need a way of showing if a player has a red name (criminal) then output.

--- End quote ---
That's a bad way of doing it. Check %client.isCriminal or %client.jobType or whatever variable it uses
tyler0:

--- Quote from: Headcrab Zombie on July 19, 2011, 03:44:59 PM ---Oh, right
That's a bad way of doing it. Check %client.isCriminal or %client.jobType or whatever variable it uses

--- End quote ---

This will work for Iban's City RP?

Tried and didn't give any result \/

--- Code: ---registerOutputEvent(Player,ifWanted,"");

function Player::ifWanted(%client) {
if(%client.isCriminal) {
messageClient(%client,'',"Yes");
} else {
messageClient(%client,'',"No");
}
}
--- End code ---

I also looked through his scripts and found he uses %client.getWantedLevel() so instead i tried earlier and no result.


--- Code: ---registerOutputEvent(Player,ifWanted,"");

function Player::ifWanted(%client) {
if(%client.getWantedLevel()) {
messageClient(%client,'',"Yes");
} else {
messageClient(%client,'',"No");
}
}
--- End code ---

For the code above it's result is unknown "getWantedLevel" so... thats not going to work.
Headcrab Zombie:
The variable names I gave you were just to tell you what you should try to do. You need to look up the actual name yourself.
Use %client.dump() and look for something relating to job type or criminal status.

Also, in a player method, the first argument is player. So, your code should look something like this:


--- Code: ---function Player::ifWanted(%player) {
if(%player.client.isCriminal) {
messageClient(%client,'',"Yes");
} else {
messageClient(%client,'',"No");
}
}
--- End code ---

Or, what would make even more sense, would be to just make it a client event, not a player event.
Navigation
Message Index
Previous page

Go to full version