GetGuestPlayers: Difference between revisions
Jump to navigation
Jump to search
Abdul KariM (talk | contribs) |
Abdul KariM (talk | contribs) |
||
Line 67: | Line 67: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Example | ==Example 3== | ||
This example show number players not login or Guest Account | This example show number players not login or Guest Account | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
Line 73: | Line 73: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Author: Abdul_KariM | Author: Abdul_KariM |
Revision as of 02:34, 20 August 2016
Syntax
table getGuestPlayers ( )
Returns
Returns All Players not Login or All Players Guest Account , And vice false
Code
Click to collapse [-]
Serverfunction getGuestPlayers ( ) local Guest = { } ; for _ , players_ in ipairs ( getElementsByType ( "player" ) ) do local playerAcc = getPlayerAccount ( players_ ) if isGuestAccount ( playerAcc ) then table.insert ( Guest , players_ ) end end return Guest end
Example
This example gets players Guest Account and show msg login or register
addCommandHandler ( "getGuestPlayers_" , function ( ) local GuestPlayers = getGuestPlayers ( ) if ( #GuestPlayers ~= 0 ) then for _ , v in ipairs ( GuestPlayers ) do outputChatBox ( getPlayerName ( v ) : gsub ( "#%x%x%x%x%x%x", "" ) .. "plz Login or Register" , v , 255 , 255 , 255 , true ) end end end ) ; -- F8 Say : getGuestPlayers_
Example 2
This example gets players Guest Account and kill they
addCommandHandler ( "killGuestPlayers" , function ( ) local GuestPlayers = getGuestPlayers ( ) if ( #GuestPlayers ~= 0 ) then for _ , v in ipairs ( GuestPlayers ) do killPed ( v ) end end end ) ; --F8 Say : killGuestPlayers
Example 3
This example show number players not login or Guest Account
outputChatBox ( #getGuestPlayers ( ) )
Author: Abdul_KariM