How do you check if something is a player?

Author Topic: How do you check if something is a player?  (Read 5110 times)

I tried using

Code: [Select]
if(%col.getclassname() $= "PlayerStandardArmor")

But it doesn't work?

if(%col.getClassName() $= "Player")

I would of done if(%player)

....why didn't you just put "echo(%col.getclassname());" so you'd know what it returns for a player?

....why didn't you just put "echo(%col.getclassname());" so you'd know what it returns for a player?

Tried that, for some reason it didn't echo anything.

And, thanks Ephi that worked.

Another question: Is it possible to get someones name from their bl ID?

Code: [Select]
function findnamebyblid(%blid) {
  %cl = -1;
  for( %i = 0; %i < ClientGroup.getCount(); %i++) {
    %cl = ClientGroup.getObject(%i);
    if (%cl.bl_id == %blid)
%cname = %cl.name;
    }
  return %cname;
}
And find player object by name:
Code: [Select]
function findobjectbyblid(%blid) {
  %cl = -1;
  for( %i = 0; %i < ClientGroup.getCount(); %i++) {
    %cl = ClientGroup.getObject(%i);
    if (%cl.bl_id == %blid)
%pobject = %cl.player;
    }
  return %pobject;
}
« Last Edit: March 31, 2007, 04:27:16 AM by -=>RR<=-MasterCE »

Both them scripts are identical...
Code: [Select]
function findplayerbyname(%name) {
  %cl = -1;
  for( %i = 0; %i < ClientGroup.getCount(); %i++) {
    %cl = ClientGroup.getObject(%i);
    if (%cl.name == %name)
%cobj = %cl.player;
    }
  return %cobj;
}
And if you want the Client object:
Code: [Select]
function findclientbyname(%name) {
  %cl = -1;
  for( %i = 0; %i < ClientGroup.getCount(); %i++) {
    %cl = ClientGroup.getObject(%i);
    if (%cl.name == %name)
%cobj = %cl;
    }
  return %cobj;
}

I searched for my old script, I posted a quote, edited quote to a name one and saved, then searched again and didn't notice I was quoting what I just posted. Fixed....I'm mad....trying not to rip apart the universe to punch you through the internet....because it was a simple little thing
« Last Edit: March 31, 2007, 04:29:38 AM by -=>RR<=-MasterCE »

Anyone know how to open a gui on the clients side? canvas.pushdialog(blah); works, but for some reason i seem to remember someone saying that's not how you do it.

In RTB i used something like commandtoclient('OpenClose'); but it doesn't seem to exist anymore?
« Last Edit: March 31, 2007, 04:36:31 AM by Game master pro »

You can't as what RTB did would actually be considered a type of exploit to opennig thigns on a client...you could actually spam that command and annoy the crap out of people on your server. No crap like that in Retail.

You can't as what RTB did would actually be considered a type of exploit to opennig thigns on a client...you could actually spam that command and annoy the crap out of people on your server. No crap like that in Retail.

But how do i make it open for only the person that did it? Like when you hit something with a wrench, it opens the wrench gui. How i have my thing now, you hit something, and the gui opens for only me.

There already is a way to make annoying GUIs pop up in Retail. See the F11 BrickBin trigger.

There already is a way to make annoying GUIs pop up in Retail. See the F11 BrickBin trigger.

Trigger code is dso'd?

I tried doing:
Code: [Select]
function clientcmdPush(%gui)
{
canvas.pushDialog(%gui)
}
( Stolen from rtb :P )

But it just goes unknown function clientCmdPush.


Here, have some client commands.

AddBrickManLine
AddMiniGameColor
AddMiniGameLine
AddUnBanLine
AdminFailure
AdminSuccess
BottomPrint
BSD_LoadBricks
BSD_Open
CenterPrint
ChatMessage
clearBottomPrint
ClearBrickMan
ClearCenterPrint
ClearMapList
ClearUnBans
CreateMiniGameFail
CreateMiniGameSuccess
DoUpdates
GameEnd
GameStart
LoadBricksConfirmHandshake
LoadBricksHandshake
MessageBoxOK
MiniGameInvite
MissionEnd
MissionStart
MissionStartPhase1
MissionStartPhase2
MissionStartPhase3
OpenPrintSelectorDlg
OpenWrenchDlg
OpenWrenchSoundDlg
OpenWrenchVehicleSpawnDlg
PlayGui_CreateToolHud
PlayGui_LoadPaint
PSD_KillPrints
RemoveMiniGameLine
ResetMiniGameList
ServerMessage
SetBuildingDisabled
SetFocalPoint
SetLetterPrintInfo
SetPaintingDisabled
SetPlayingMiniGame
SetRemoteServerData
SetRunningMiniGame
SetScrollMode
SetWrenchData
ShowEnergyBar
StopBrickControls
SyncClock
TimeScale
TrustDemoted
TrustInvite
TrustInviteAccepted
TrustListUpload_Start
UpdateMapList
UpdatePrefs
UseBrickControls
Wrench_LoadMenus
WrenchLoadingDone

I would of done if(%player)

Thats a load. That would just check that %player was equal to 1, or not nothing, or something.
« Last Edit: April 01, 2007, 02:59:59 AM by Ephialtes »