Difference between revisions of "Category:Player functions"
From Fortress Forever Wiki
Jump to navigationJump to searchm |
m (→Example) |
||
(10 intermediate revisions by 2 users not shown) | |||
Line 27: | Line 27: | ||
| '''AddFortPoints'''(integer, string) ||Gives the player Fortress Points. String is an explanation for the points, eg. "Hunted Escape" | | '''AddFortPoints'''(integer, string) ||Gives the player Fortress Points. String is an explanation for the points, eg. "Hunted Escape" | ||
|- | |- | ||
− | | '''AddHealth'''(integer) ||Gives the player health points. Negative numbers will hurt the player | + | | '''AddHealth'''(integer, bool) ||Gives the player health points. Negative numbers will hurt the player. If set to true the player will over-heal their maximum health. |
+ | |- | ||
+ | | integer '''GetFortPoints'''() || Returns the player's Fortress Points. | ||
+ | |- | ||
+ | | integer '''GetFrags'''() || Returns the player's Frag count. | ||
+ | |- | ||
+ | | integer '''GetDeaths'''() || Returns the player's death count. | ||
|- | |- | ||
| integer '''GetClass'''() ||Returns the class of the player as a number (0-9) | | integer '''GetClass'''() ||Returns the class of the player as a number (0-9) | ||
− | |||
− | |||
|- | |- | ||
| string '''GetName'''() ||Returns the name of the player | | string '''GetName'''() ||Returns the name of the player | ||
Line 87: | Line 91: | ||
| boolean '''IsOnGround'''() | | boolean '''IsOnGround'''() | ||
|- | |- | ||
− | | boolean '''IsInAir'''() | + | | boolean '''IsInAir'''( int )|| Checks if the player is the specified number of units above the ground. |
|- | |- | ||
| boolean '''IsDucking'''() | | boolean '''IsDucking'''() | ||
Line 96: | Line 100: | ||
|- | |- | ||
| boolean '''IsGrenadePrimed'''() | | boolean '''IsGrenadePrimed'''() | ||
+ | |- | ||
+ | | boolean '''IsFlashlightOn'''() | ||
|- | |- | ||
| integer '''GetAmmoInClip'''() | | integer '''GetAmmoInClip'''() | ||
Line 113: | Line 119: | ||
| '''MarkRadioTag'''() || No uses found | | '''MarkRadioTag'''() || No uses found | ||
|- | |- | ||
− | | ''' | + | | '''RemoveArmor'''(integer) || Removes armor from the player |
− | |||
− | |||
|- | |- | ||
| '''RemoveLocation'''(entityId) || Clears the player's location info? Never used. | | '''RemoveLocation'''(entityId) || Clears the player's location info? Never used. | ||
Line 124: | Line 128: | ||
|- | |- | ||
| '''SetDisguisable'''(boolean) || Allow/disallow a spy to use disguise | | '''SetDisguisable'''(boolean) || Allow/disallow a spy to use disguise | ||
+ | |- | ||
+ | | '''SetDisguise'''(int teamId, int classId, bool isInstant) || Changes the player's disguise. | ||
+ | |- | ||
+ | | '''ResetDisguise'''() || Resets the player's disguise. | ||
|- | |- | ||
| boolean '''IsDisguisable'''() || returns whether the player is allowed to disguise | | boolean '''IsDisguisable'''() || returns whether the player is allowed to disguise | ||
Line 175: | Line 183: | ||
| '''Freeze'''(boolean) || Stop the player from moving or shooting. Send false to unfreeze a player. | | '''Freeze'''(boolean) || Stop the player from moving or shooting. Send false to unfreeze a player. | ||
|- | |- | ||
− | | boolean '''IsFrozen'''() || | + | | boolean '''IsFrozen'''() || Returns true or false depending on whether the player is in a frozen state. |
+ | |- | ||
+ | | '''RemoveBuildables'''() || Removes all the player's owned buildables ( [[Buildables|List of buildables]] ) | ||
+ | |- | ||
+ | | '''RemoveProjectiles'''() || Removes all the player's owned projectiles ( rockets, nails, etc. ) | ||
+ | |- | ||
+ | | '''RemoveItems'''() || Removes all the player's owned buildables AND projectiles. | ||
+ | |- | ||
+ | | '''LockInPlace'''(boolean) || Stop the player from moving, and disable their gravity. Player can still rotate and shoot. Send false to unlock player. | ||
+ | |- | ||
+ | | '''SetGravity'''(float) || Sets the player's gravity. | ||
+ | |- | ||
+ | | float '''GetGravity'''() || Gets the player's gravity. | ||
+ | |- | ||
+ | | '''SetVelocity'''( Vector(0,0,0) ) || Sets the player's velocity. | ||
+ | |- | ||
+ | | '''GetVelocity'''() || Gets the player's velocity. | ||
+ | |- | ||
+ | | '''SpeedMod'''(float) || Sets a host_timescale type movement to the player's speed. | ||
+ | |- | ||
+ | | float '''GetSpeedMod'''() || Gets the player's speed mod. | ||
+ | |- | ||
+ | |'''EmitSound'''(String) || Causes the player or assigned entity to emit a sound. Make sure to precache sounds. | ||
+ | |- | ||
+ | | '''GetSentryGun'''() || Gets the player's Sentry gun or nil if it's unbuilt. | ||
+ | |- | ||
+ | | '''GetDispenser'''() || Gets the player's Dispenser or nil if it's unbuilt. | ||
+ | |- | ||
+ | | '''GetDetpack'''() || Gets the player's Detpack or nil if it's unbuilt. | ||
+ | |- | ||
+ | | '''GetJumpPad'''() || Gets the player's Jump Pad or nil if it's unbuilt. | ||
+ | |- | ||
+ | | '''SetFriction'''() || Sets the player's friction similar to sv_friction | ||
+ | |- | ||
|} | |} | ||
[[Category:Lua]] | [[Category:Lua]] | ||
[[Category:Lua_Commands]] | [[Category:Lua_Commands]] |
Latest revision as of 00:49, 31 May 2017
Any player that's connected to the server can be accessed by the lua system. Once you have identified a specific player object you can use these functions to affect the player or get information about it. UsageCFFPlayer:function(parameters) Examplefunction location_info:ontouch( touch_entity ) -- set the location of the player if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) --this new variable is of type CFFPlayer; we can use any player function on it player:SetLocation(entity:GetId(), self.text, self.team) end end
|
This category currently contains no pages or media.