Author Topic: Event parameters? [SOLVED]  (Read 945 times)

For an event with
Code: [Select]
function fxDTSBrick::RPJail(%brick, %client) as its function with those parameters, how do I get data from someone who is touching the brick when the function is triggered with onPlayerTouch->Self->RPJail?
What I'm trying to do is when the function is triggered, it's supposed to grab data from the player who triggered it (the player touching the brick) what variable do I use for that or how do I get it?
« Last Edit: March 03, 2014, 12:17:37 AM by Gordo12699 »

Just do

function Player::RPJail(%this)
{
    //Stuff here
}

registerOutputEvent("player", "RPJail");


It is less work, so when you use OnPlayerTouch > Player > RPJail, it should work just fine. Using bricks to get data from a player is a lot more confusing.
« Last Edit: March 02, 2014, 10:22:52 PM by Advanced Bot »

Alright, thanks, I'll let you know how it turns out!

Alright, thanks, I'll let you know how it turns out!
Oops, please look at my edit. I forgot something.

Ah thanks, and how would I do an adminOnly check for the event, so it would only trigger if the owner of the brick the event is on is admin?

You may need to download an event restriction mod.


Ah thanks, and how would I do an adminOnly check for the event, so it would only trigger if the owner of the brick the event is on is admin?
This usually causes quite a lot of problems. Normally, we can just check if the brick's client is an admin, however when bricks are loaded or the client disconnects, the client variable is lost. You can however get the BL_ID of the owner from the brickgroup. This will always be set. Then to check wether the BL_ID should be admin is a case of checking through the Auto Admin prefs.

%brick.getGroup() gets the brickgroup of the brick.
%brickgroup.bl_id is the BL_ID of the owner of the brickgroup.

Not sure what the pref for auto admin list is on the top of my head.

Not sure what the pref for auto admin list is on the top of my head.
There's $Pref::Server::AutoAdminList and $Pref::Server::AutoSuperAdminList. But what if the client is an admin, but just not an auto admin?



Check both.
As in.
Check if the client is an admin, or if the ID is on the auto admin list.

If they're on the auto [super] admin list, they should be an admin. You shouldn't be expected to check the auto lists just because some other add-on doesn't properly give admin if the client is already there. Simply checking the current manual state is enough.

%client.isAdmin || %client.isSuperAdmin

Yeah but that wont work if the client isn't even on the server.