GetPlayerAnnounceValue: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with '__NOTOC__ {{Server function}} This function retrieves a players ASE announce value under a certain key. ==Syntax== <syntaxhighlight lang="lua">string getPlayerAnnounceValue ( element thePlayer…')
 
mNo edit summary
Line 14: Line 14:


==Example==
==Example==
<section show="true" name="Server" class="server">
This example adds a command named "getscore" which outputs a players "score" value to his chatbox.
This example adds a command named "getscore" which outputs a players "score" value to his chatbox.
<section show="true" name="Server" class="server">
<syntaxhighlight lang="lua">function getScore ( playerSource, cmdName )
<syntaxhighlight lang="lua">function getScore ( playerSource, cmdName )
     local scoreValue = getPlayerAnnounceValue ( playerSource, "score" )
     local scoreValue = getPlayerAnnounceValue ( playerSource, "score" )

Revision as of 22:25, 14 November 2011

This function retrieves a players ASE announce value under a certain key.

Syntax

string getPlayerAnnounceValue ( element thePlayer, string key )

Required Arguments

  • thePlayer: This is the Player whos value you want to retrieve.
  • key: The name of the key.

Returns

This function returns a string containing the requested value if a valid key was specified or false otherwise.

Example

Click to collapse [-]
Server

This example adds a command named "getscore" which outputs a players "score" value to his chatbox.

function getScore ( playerSource, cmdName )
    local scoreValue = getPlayerAnnounceValue ( playerSource, "score" )
    if ( scoreValue ) then
        outputChatBox ( "Your score: "..scoreValue, playerSource )
    end
end

addCommandHandler ( "getscore", getScore )

See Also