AR/getPlayerCount

From Multi Theft Auto: Wiki
Revision as of 20:32, 17 October 2012 by Talal07 (talk | contribs) (Created page with "{{Server function}} __NOTOC__ هذه الوظيفة تقوم باحضار عدد الاعبين الموجودين في السيرفر {{Note|#getElementsByType("player") works t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

هذه الوظيفة تقوم باحضار عدد الاعبين الموجودين في السيرفر

[[{{{image}}}|link=|]] Note: #getElementsByType("player") works the same as this function but also works client side unlike this function.

Syntax

int getPlayerCount ( )

Returns

Returns the number of players connected to the server as an int.

Example

This example displays a chat message with the number of players connected to the server when a player joins or quits.

function playerCount ( )
	outputChatBox ( "There are now " .. getPlayerCount() .. " players on this server!" )
end
addEventHandler ( "onPlayerJoin", getRootElement(), playerCount )
addEventHandler ( "onPlayerQuit", getRootElement(), playerCount )

See Also