OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: Rommel92 on 28 Apr 2008, 21:33:51

Title: isPlayer
Post by: Rommel92 on 28 Apr 2008, 21:33:51
Code: [Select]
If (isPlayer) exitWith {};
Missing ;

 :dunno:
Clearly the command is wrong, as I was just screwing around with it I just replaced with:
Code: [Select]
If !(isNull player) exitWith {};
But why the error?
Title: Re: isPlayer
Post by: myke13021 on 28 Apr 2008, 21:37:42
Wrong use of the command.
Quote
Description:
    Check if given person is a human player.

Syntax

Syntax:
    isPlayer Object
Parameters:
    Object
Return Value:
    Boolean
You didn't passed an Object which could be checked.

Also check this:
Quote
This is not the same as testing object == player, because in MP it tests for any player, not only for the local one. If object is a vehicle, the test is done for the vehicle commander.
Title: Re: isPlayer
Post by: Rommel92 on 28 Apr 2008, 21:42:29
Ah k, yeh should've read the Biki first, was just reading into another thread, in which Mr Peanut posted:
Code: [Select]
if isServer then {onPlayerConnected "publicVariable ""startPos""";};
if isPlayer then {nil = [] execVM "setPlayerStart.sqf";};

And no one seemed to mention anything about it being dud... so... maybe theres an exception here, or no one noticed...  :P
Title: Re: isPlayer
Post by: Loyalguard on 28 Apr 2008, 22:32:35
isPlayer checks to see if the unit is a human (true) or AI (false).  It is not used to validate who the player is or compare it to other players.
Title: Re: isPlayer
Post by: Mr.Peanut on 12 May 2008, 17:05:47
Damn. Another screwup by yours truly! I have added a warning to that original thread not to use the snippet.