Difference between revisions of "Category:Player functions"

From Fortress Forever Wiki
Jump to: navigation, search
m (tables yea)
Line 16: Line 16:
 
end
 
end
 
end</pre>
 
end</pre>
 
+
{| border="1" cellspacing="2" cellpadding="5"
* '''AddAmmo'''([[Lua:Flags#Ammo]], integer) Gives ammunition to the player
+
! Command !! Description
* '''AddArmor'''(integer) Gives armor to the player
+
|-
* '''AddFrags'''(integer) Adds to the player's kill count
+
|'''AddAmmo'''([[Lua:Flags#Ammo]], integer) || Gives ammunition to the player
* '''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
+
| '''AddArmor'''(integer) ||Gives armor to the player
* integer '''GetClass'''() Returns the class of the player as a number (0-9)
+
|-
* string '''GetClassName'''() Returns the class of the player as a string
+
| '''AddFrags'''(integer) ||Adds to the player's kill count
* string '''GetName'''() Returns the name of the player
+
|-
* integer '''GetArmor'''() Returns the player's armor level
+
| '''AddFortPoints'''(integer, string) ||Gives the player Fortress Points. String is an explanation for the points, eg. "Hunted Escape"
* integer '''GetMaxArmor'''() Returns the player's max armor
+
|-
* integer '''GetHealth'''() Returns the player's health points
+
| '''AddHealth'''(integer) ||Gives the player health points. Negative numbers will hurt the player
* integer '''GetMaxHealth'''() Returns the player's max health
+
|-
* boolean '''HasItem'''(string) returns true or false is the player is holding the named [[Lua:info_ff_script]]
+
| integer '''GetClass'''() ||Returns the class of the player as a number (0-9)
* boolean '''IsFeetDeepInWater'''()
+
|-
* boolean '''IsInNoBuild'''()
+
| string '''GetClassName'''() ||Returns the class of the player as a string
* boolean '''IsUnderWater'''()
+
|-
* boolean '''IsWaistDeepInWater'''()
+
| string '''GetName'''() ||Returns the name of the player
* boolean '''IsInAttack1'''() Is the player pressing his *primary attack* key?
+
|-
* boolean '''IsInAttack2'''()
+
| integer '''GetArmor'''() || Returns the player's armor level
* boolean '''IsInUse'''()
+
|-
* boolean '''IsInJump'''()
+
| integer '''GetMaxArmor'''() || Returns the player's max armor
* boolean '''IsInForward'''()
+
|-
* boolean '''IsInBack'''()
+
| integer '''GetHealth'''() || Returns the player's health points
* boolean '''IsInMoveLeft'''()
+
|-
* boolean '''IsInMoveRight'''()
+
| integer '''GetMaxHealth'''() || Returns the player's max health
* boolean '''IsInLeft'''()
+
|-
* boolean '''IsInRight'''()
+
| boolean '''HasItem'''(string) || returns true or false is the player is holding the named [[Lua:info_ff_script]]
* boolean '''IsInRun'''()
+
|-
* boolean '''IsInReload'''()
+
| boolean '''IsFeetDeepInWater'''()
* boolean '''IsInSpeed'''() same as walk?
+
|-
* boolean '''IsInWalk'''()
+
| boolean '''IsInNoBuild'''()
* boolean '''IsInZoom'''()
+
|-
* boolean '''IsOnGround'''()  
+
| boolean '''IsUnderWater'''()
* boolean '''IsInAir'''()
+
|-
* boolean '''IsDucking'''()
+
| boolean '''IsWaistDeepInWater'''()
* boolean '''IsGrenade1Primed'''() Player has a live frag grenade
+
|-
* boolean '''IsGrenade2Primed'''()
+
| boolean '''IsInAttack1'''() || Is the player pressing his *primary attack* key?
* boolean '''IsGrenadePrimed'''()
+
|-
* integer '''GetAmmoInClip'''()
+
| boolean '''IsInAttack2'''()
* integer '''GetAmmoInClip'''( weaponname )
+
|-
* '''SetAmmoInClip'''( num )
+
| boolean '''IsInUse'''()
* '''SetAmmoInClip'''( weaponname, num )
+
|-
* integer '''GetAmmoCount'''( ammotype )
+
| boolean '''IsInJump'''()
* '''ReloadClips'''() magic reload!
+
|-
* boolean '''IsBot'''()
+
| boolean '''IsInForward'''()
* '''MarkRadioTag'''() No uses found
+
|-
* '''AddAmmo'''([[Lua:Flags#Ammo]], integer) Takes ammunition from the player
+
| boolean '''IsInBack'''()
* '''AddArmor'''(integer) Takes armor from the player
+
|-
* '''RemoveLocation'''(entityId) Clears the player's location info? Never used.
+
| boolean '''IsInMoveLeft'''()
* string '''GetLocation'''() Returns the current map location of the player
+
|-
* '''Respawn'''() Respawn the player.
+
| boolean '''IsInMoveRight'''()
* '''SetDisguisable'''(boolean) Allow/disallow a spy to use disguise
+
|-
* boolean '''IsDisguisable'''() returns whether the player is allowed to disguise
+
| boolean '''IsInLeft'''()
* '''SetCloakable'''(boolean) Allow/disallow a spy to use cloak
+
|-
* boolean '''IsCloakable'''() returns whether the player is allowed to cloak
+
| boolean '''IsInRight'''()
* '''SetRespawnable'''(boolean) Send false to make players stay dead (unable to respawn).
+
|-
* boolean '''IsRespawnable'''() See above.
+
| boolean '''IsInRun'''()
* '''SetLocation'''(entityId, string, [[Lua:Flags#Team]]) Sends text to the player's location HUD. Team determines the color of the text.
+
|-
* '''SetRespawnDelay'''   Probably should send this an integer or float.
+
| boolean '''IsInReload'''()
* string '''GetActiveWeaponName'''() returns the [[Lua:weapon_classes]] of the weapon equipped by the player, eg. "ff_weapon_spanner"
+
|-
* '''GiveWeapon'''(string, boolean) Give the player a weapon, specified by [[Lua:weapon_classes]]. If boolean is set to true, the player will autoswitch to this weapon.
+
| boolean '''IsInSpeed'''() || same as walk?
* '''RemoveWeapon'''(string) Take from the player a weapon, specified by [[Lua:weapon_classes]]
+
|-
* '''RemoveAllWeapons'''() Strip all the player's weapons.
+
| boolean '''IsInWalk'''()
* '''RemoveAllAmmo'''(boolean)
+
|-
* boolean '''IsCloaked'''()
+
| boolean '''IsInZoom'''()
* boolean '''IsDisguised'''()  
+
|-
* integer '''GetDisguisedClass'''()
+
| boolean '''IsOnGround'''()  
* integer '''GetDisguisedTeam'''()
+
|-
* '''AddEffect'''( [[Lua:Flags#EF]], EFFECT_DURATION, ICON_DURATION, SPEED_MULTIPLIER ) Adds a status affect to the player
+
| boolean '''IsInAir'''()
* boolean '''IsEffectActive'''([[Lua:Flags#EF]])
+
|-
* '''RemoveEffect'''([[Lua:Flags#EF]]) Cancels a status effect on the player
+
| boolean '''IsDucking'''()
* integer '''GetId'''() Gets the ID number of the player on the server
+
|-
* integer '''GetSteamID'''()
+
| boolean '''IsGrenade1Primed'''() || Player has a live frag grenade
* integer '''GetPing'''()
+
|-
* '''GetPacketloss'''()
+
| boolean '''IsGrenade2Primed'''()
* boolean '''IsAlive'''()
+
|-
* '''Freeze'''(boolean) Stop the player from moving
+
| boolean '''IsGrenadePrimed'''()
 
+
|-
 +
| integer '''GetAmmoInClip'''()
 +
|-
 +
| integer '''GetAmmoInClip'''( weaponname )
 +
|-
 +
| '''SetAmmoInClip'''( num )
 +
|-
 +
| '''SetAmmoInClip'''( weaponname, num )
 +
|-
 +
| integer '''GetAmmoCount'''( ammotype )
 +
|-
 +
| '''ReloadClips'''() || magic reload!
 +
|-
 +
| boolean '''IsBot'''()
 +
|-
 +
| '''MarkRadioTag'''() || No uses found
 +
|-
 +
| '''AddAmmo'''([[Lua:Flags#Ammo]], integer) || Gives ammunition to the player
 +
|-
 +
| '''AddArmor'''(integer) || Gives armor to the player
 +
|-
 +
| '''RemoveLocation'''(entityId) || Clears the player's location info? Never used.
 +
|-
 +
| string '''GetLocation'''() || Returns the current map location of the player
 +
|-
 +
| '''Respawn'''() || Respawn the player.
 +
|-
 +
| '''SetDisguisable'''(boolean) || Allow/disallow a spy to use disguise
 +
|-
 +
| boolean '''IsDisguisable'''() || returns whether the player is allowed to disguise
 +
|-
 +
| '''SetCloakable'''(boolean) || Allow/disallow a spy to use cloak
 +
|-
 +
| boolean '''IsCloakable'''() || returns whether the player is allowed to cloak
 +
|-
 +
| '''SetRespawnable'''(boolean) || Send false to make players stay dead (unable to respawn).
 +
|-
 +
| boolean '''IsRespawnable'''() || See above.
 +
|-
 +
| '''SetLocation'''(entityId, string, [[Lua:Flags#Team]]) || Sends text to the player's location HUD. Team determines the color of the text.
 +
|-
 +
| '''SetRespawnDelay''' || Probably should send this an integer or float.
 +
|-
 +
| string '''GetActiveWeaponName'''() || returns the [[Lua:weapon_classes]] of the weapon equipped by the player, eg. "ff_weapon_spanner"
 +
|-
 +
| '''GiveWeapon'''(string, boolean) || Give the player a weapon, specified by [[Lua:weapon_classes]]. If boolean is set to true, the player will autoswitch to this weapon.
 +
|-
 +
| '''RemoveWeapon'''(string) || Take from the player a weapon, specified by [[Lua:weapon_classes]]
 +
|-
 +
| '''RemoveAllWeapons'''() || Strip all the player's weapons.
 +
|-
 +
| '''RemoveAllAmmo'''(boolean)
 +
|-
 +
| boolean '''IsCloaked'''()
 +
|-
 +
| boolean '''IsDisguised'''()  
 +
|-
 +
| integer '''GetDisguisedClass'''()
 +
|-
 +
| integer '''GetDisguisedTeam'''()
 +
|-
 +
| '''AddEffect'''( [[Lua:Flags#EF]], EFFECT_DURATION, ICON_DURATION, SPEED_MULTIPLIER ) || Adds a status affect to the player. SPEED_MULTIPLIER is used for altering the player's speed.
 +
|-
 +
| boolean '''IsEffectActive'''([[Lua:Flags#EF]])
 +
|-
 +
| '''RemoveEffect'''([[Lua:Flags#EF]]) || Cancels a status effect on the player
 +
|-
 +
| integer '''GetId'''() || Gets the ID number of the player
 +
|-
 +
| integer '''GetSteamID'''()
 +
|-
 +
| integer '''GetPing'''()
 +
|-
 +
| '''GetPacketloss'''()
 +
|-
 +
| boolean '''IsAlive'''()
 +
|-
 +
| '''Freeze'''(boolean) || Stop the player from moving or shooting. Send false to unfreeze a player.
 +
|}
 
[[Category:Lua]]
 
[[Category:Lua]]
 
[[Category:Lua_Commands]]
 
[[Category:Lua_Commands]]

Revision as of 14:14, 5 May 2010


Mapping for FF
The Basics

Setting up Hammer
Getting Started With Lua
Releasing a map

FF-specific Entities

Lua location system

Map Templates
FF Lua Documentation

Entity Typing
Entity Collections

Commands
Callbacks

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.

Usage

CFFPlayer:function(parameters)

Example

function 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
Command Description
AddAmmo(Lua:Flags#Ammo, integer) Gives ammunition to the player
AddArmor(integer) Gives armor to the player
AddFrags(integer) Adds to the player's kill count
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
integer GetClass() Returns the class of the player as a number (0-9)
string GetClassName() Returns the class of the player as a string
string GetName() Returns the name of the player
integer GetArmor() Returns the player's armor level
integer GetMaxArmor() Returns the player's max armor
integer GetHealth() Returns the player's health points
integer GetMaxHealth() Returns the player's max health
boolean HasItem(string) returns true or false is the player is holding the named Lua:info_ff_script
boolean IsFeetDeepInWater()
boolean IsInNoBuild()
boolean IsUnderWater()
boolean IsWaistDeepInWater()
boolean IsInAttack1() Is the player pressing his *primary attack* key?
boolean IsInAttack2()
boolean IsInUse()
boolean IsInJump()
boolean IsInForward()
boolean IsInBack()
boolean IsInMoveLeft()
boolean IsInMoveRight()
boolean IsInLeft()
boolean IsInRight()
boolean IsInRun()
boolean IsInReload()
boolean IsInSpeed() same as walk?
boolean IsInWalk()
boolean IsInZoom()
boolean IsOnGround()
boolean IsInAir()
boolean IsDucking()
boolean IsGrenade1Primed() Player has a live frag grenade
boolean IsGrenade2Primed()
boolean IsGrenadePrimed()
integer GetAmmoInClip()
integer GetAmmoInClip( weaponname )
SetAmmoInClip( num )
SetAmmoInClip( weaponname, num )
integer GetAmmoCount( ammotype )
ReloadClips() magic reload!
boolean IsBot()
MarkRadioTag() No uses found
AddAmmo(Lua:Flags#Ammo, integer) Gives ammunition to the player
AddArmor(integer) Gives armor to the player
RemoveLocation(entityId) Clears the player's location info? Never used.
string GetLocation() Returns the current map location of the player
Respawn() Respawn the player.
SetDisguisable(boolean) Allow/disallow a spy to use disguise
boolean IsDisguisable() returns whether the player is allowed to disguise
SetCloakable(boolean) Allow/disallow a spy to use cloak
boolean IsCloakable() returns whether the player is allowed to cloak
SetRespawnable(boolean) Send false to make players stay dead (unable to respawn).
boolean IsRespawnable() See above.
SetLocation(entityId, string, Lua:Flags#Team) Sends text to the player's location HUD. Team determines the color of the text.
SetRespawnDelay Probably should send this an integer or float.
string GetActiveWeaponName() returns the Lua:weapon_classes of the weapon equipped by the player, eg. "ff_weapon_spanner"
GiveWeapon(string, boolean) Give the player a weapon, specified by Lua:weapon_classes. If boolean is set to true, the player will autoswitch to this weapon.
RemoveWeapon(string) Take from the player a weapon, specified by Lua:weapon_classes
RemoveAllWeapons() Strip all the player's weapons.
RemoveAllAmmo(boolean)
boolean IsCloaked()
boolean IsDisguised()
integer GetDisguisedClass()
integer GetDisguisedTeam()
AddEffect( Lua:Flags#EF, EFFECT_DURATION, ICON_DURATION, SPEED_MULTIPLIER ) Adds a status affect to the player. SPEED_MULTIPLIER is used for altering the player's speed.
boolean IsEffectActive(Lua:Flags#EF)
RemoveEffect(Lua:Flags#EF) Cancels a status effect on the player
integer GetId() Gets the ID number of the player
integer GetSteamID()
integer GetPing()
GetPacketloss()
boolean IsAlive()
Freeze(boolean) Stop the player from moving or shooting. Send false to unfreeze a player.

This category currently contains no pages or media.