AR/kickPlayer: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{Server function}}
{{Server function}}
__NOTOC__
__NOTOC__
This function will kick the specified player from the server.
هذه الوظيفة سـ تطرد الاعب المحدد من السيرفر


==Syntax==  
==Syntax==  
Line 13: Line 13:


===Required Arguments===  
===Required Arguments===  
*'''kickedPlayer:''' The player that will be kicked from the server
*'''kickedPlayer:''' الاعب الذي سيام طرده من السيرفر
 
===Optional Arguments===  
===Optional Arguments===  
{{OptionalArg}}  
{{OptionalArg}}  
*'''responsiblePlayer:''' The player that is responsible for the event. '''Note''': If left out as in the second syntax, responsible player for the kick will be "Console" (Maximum 30 characters if using a string).
*'''responsiblePlayer:''' console الاعب او الشيء الذي سيتحمل مسؤلية طرد الاعب المحدد , يمكنه ان يكون من الـ
*'''reason:''' The reason for the kick.
( اقصى عدد للحروف 30 )
*'''reason:''' سبب الطرد


===Returns===
===Returns===
Returns ''true'' if the player was kicked succesfully, ''false'' if invalid arguments are specified.
Returns ''true'' if the player was kicked succesfully, ''false'' if invalid arguments are specified.


==Example==  
==مثال==  
This example lets a player kick anyone who has a lower level.
هذا المثال سـ يطرد كل من معه مال اكبر من 999999 عند دخول الاعب حسابه
<syntaxhighlight lang="lua">
function kickCheater( )
function kickPlayerHandler ( sourcePlayer, commandname, kickedname, reason )
    -- اذا رآى ان الاعب لديه أكثر من 999999 سيطرده
-- Get player element from the name
if ( getPlayerMoney( source ) > 999999 ) then
local kicked = getPlayerFromName ( kickedname )
        -- طرد الاعب
-- If the client who sent the command has a higher level
        kickPlayer( source )
if ( hasObjectPermissionTo ( sourcePlayer, "function.kickPlayer" ) ) then
-- Kick the player
kickPlayer ( kicked, sourcePlayer, reason )
end
end
end
end
-- Add the "kick" command handler
-- سـ تقوم الوظيفة بالعمل عند دخول الاعب
addCommandHandler ( "kick", kickPlayerHandler )
addEventHandler("onPlayerLogin", root, kickCheater)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 19:09, 1 September 2012

هذه الوظيفة سـ تطرد الاعب المحدد من السيرفر

Syntax

bool kickPlayer ( player kickedPlayer, [ player responsiblePlayer, string reason = "" ] )         

or

bool kickPlayer ( player kickedPlayer, [ string reason = "" ] )

Required Arguments

  • kickedPlayer: الاعب الذي سيام طرده من السيرفر

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • responsiblePlayer: console الاعب او الشيء الذي سيتحمل مسؤلية طرد الاعب المحدد , يمكنه ان يكون من الـ

( اقصى عدد للحروف 30 )

  • reason: سبب الطرد

Returns

Returns true if the player was kicked succesfully, false if invalid arguments are specified.

مثال

هذا المثال سـ يطرد كل من معه مال اكبر من 999999 عند دخول الاعب حسابه function kickCheater( )

   -- اذا رآى ان الاعب لديه أكثر من 999999 سيطرده

if ( getPlayerMoney( source ) > 999999 ) then

       -- طرد الاعب
       kickPlayer( source )

end end -- سـ تقوم الوظيفة بالعمل عند دخول الاعب addEventHandler("onPlayerLogin", root, kickCheater) </syntaxhighlight>

See Also