ExecuteSQLSelect: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Note_box|It is strongly reccomended that you use the standard ''module.key'' naming for your keys, as shown in the example below. This prevents collisions between different scripts.}}
{{Note_box|It is strongly recommended that you use the standard ''module.key'' naming for your keys, as shown in the example below. This prevents collisions between different scripts.}}
This function retrieves a value from the server's registry. This is data that is stored across sessions and can be read by any script. This is useful if you want to easily store a setting for your script.
This function retrieves a value from the server's registry. This is data that is stored across sessions and can be read by any script. This is useful if you want to easily store a setting for your script.



Revision as of 11:35, 8 September 2006

This template is no longer in use as it results in poor readability. This function retrieves a value from the server's registry. This is data that is stored across sessions and can be read by any script. This is useful if you want to easily store a setting for your script.

Syntax

string getRegistryValue ( string key )

Required Arguments

  • key: The key under which the data you wish to retrieve was stored

Returns

Returns a string containing the value stored or false if no value is stored under the specified key.

Example

This example keeps track of the largest number of players playing at once on the server and announces each time the record has been broken.

addEventHandler ( "onPlayerJoin", getRootElement(), "maxPlayerCounter" )
function maxPlayerCounter ( )
    mostPlayers = getRegistryValue ( "maxPlayerCounter.mostPlayers" )
    playerCount = getPlayerCount()
    if ( mostPlayers == false or playerCount > mostPlayers )
        outputChatBox ( "New player count record: " .. playerCount .. " players!" )
        setRegistryValue ( "maxPlayerCounter.mostPlayers", playerCount )
    end
end

See Also