Difference between revisions of "Lua:IsPlayer"
From Fortress Forever Wiki
Jump to navigationJump to searchMulchman MM (talk | contribs) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Infobox manual/Header}} | ||
==IsPlayer== | ==IsPlayer== | ||
Line 28: | Line 29: | ||
end</pre> | end</pre> | ||
− | [[Category: | + | [[Category:Lua_Commands]] |
+ | {{Infobox manual/Footer}} |
Latest revision as of 16:40, 31 December 2007
IsPlayerIsPlayer is used to see if an entity index being passed into a function is a player or not. UsageIsPlayer( ent_id ) InputThe ent_id passed in is simply an integer index that refers to an entities game code ENTINDEX(). OutputThe output is true or false depending if ent_id is a player or not. ExampleHere's an example of seeing if someone touching a trigger_ff_script named "red_goal" is a player or not and then giving that players team a point: -- In the map's .LUA file... -- Define red_goal trigger_ff_script red_goal = trigger_ff_script:new({}) -- When we're touched by a player, do something function red_goal:ontouch( ent_id ) if IsPlayer( ent_id ) then -- Add 1 point to the players team AddTeamScore( GetPlayerTeam( ent_id ), 1 ) end end |