function Player::setWeapon(%this, %item, %client){ if(%client.isAdmin) { if(isObject(%this)) { if(isObject(%image = %item.image)) { %this.mountImage(%image, 0); if(%image.armReady) { %this.playThread(0, armReadyRight); } } else { %this.unmountImage(0); %this.playThread(0, root); } } }}function fxDTSbrick::setBotWeapon(%this, %item){ if(isObject(%obj = %this.vehicle)) { if(%obj.getClassName() $= "AIplayer") { %obj.setWeapon(%item); } }}
if(%client.isAdmin)
Have you got a 1 appended to the end of your registering of the event? It wont append %client otherwise.
registerOutputEvent("Player", "SetWeapon", "datablock itemData");
you'll have to do something like this:if(getBrickGroupfromObject(%brick).client.isAdmin)however this will only work if the brick's owner is online and admin.
ERROR: getBrickGroupfromObject() - "" is not an objectBackTrace: ->Player::setWeapon->getBrickGroupFromObject
function Player::setWeapon(%this, %item, %client){ if(getBrickGroupfromObject(%brick).client.isAdmin) { if(isObject(%this)) { if(isObject(%image = %item.image)) { %this.mountImage(%image, 0); if(%image.armReady) { %this.playThread(0, armReadyRight); } } else { %this.unmountImage(0); %this.playThread(0, root); } } }}function fxDTSbrick::setBotWeapon(%this, %item){ if(isObject(%obj = %this.vehicle)) { if(%obj.getClassName() $= "AIplayer") { %obj.setWeapon(%item); } }}
function Player::setWeapon(%this, %item, %client) <- no %brick{}
registerOutputEvent("fxDTSBrick", "setWeapon", "datablock ItemData");function fxDTSBrick::setWeapon(%brick, %item, %client){if(!isObject(%player = %client.player)){ return; // just to be safe} //function code goes here. you now have %brick, %player, %client and %item to work with.}
function Player::setWeapon(%this, %item, %brick, %client){ if(getBrickGroupfromObject(%brick).client.isAdmin) { if(isObject(%this)) { if(isObject(%image = %item.image)) { %this.mountImage(%image, 0); if(%image.armReady) { %this.playThread(0, armReadyRight); } } else { %this.unmountImage(0); %this.playThread(0, root); } } }}function fxDTSbrick::setBotWeapon(%this, %item){ if(isObject(%obj = %this.vehicle)) { if(%obj.getClassName() $= "AIplayer") { %obj.setWeapon(%item); } }}