SetPlayerAnnounceValue: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
m (add setRuleValue note)
Line 3: Line 3:
This function allows you to change ASE announce values for any player using a specified key.
This function allows you to change ASE announce values for any player using a specified key.
As an example this can be used to change the "score" value which will be shown at [https://www.game-state.com/ game-state.com]'s server list.
As an example this can be used to change the "score" value which will be shown at [https://www.game-state.com/ game-state.com]'s server list.
For server-wide changes you can use [[setRuleValue]]!


==Syntax==  
==Syntax==  

Revision as of 14:01, 22 June 2019

This function allows you to change ASE announce values for any player using a specified key. As an example this can be used to change the "score" value which will be shown at game-state.com's server list.

For server-wide changes you can use setRuleValue!

Syntax

bool setPlayerAnnounceValue ( element thePlayer, string key, string value )

OOP Syntax Help! I don't understand this!

Method: player:setAnnounceValue(...)
Counterpart: getPlayerAnnounceValue


Required Arguments

  • thePlayer: The player whos announce value you wish to change.
  • key: The key which the value will be stored at.
  • value: The value you wish to store.

Returns

Returns true if the value was set succesfully, false otherwise.

Example

Click to collapse [-]
Server

This small example adds a command that allows you to set your own "score" value.

function setScore ( playerSource, cmdName, scoreValue )
    if ( scoreValue ) then
        setPlayerAnnounceValue ( playerSource, "score", scoreValue )
    end
end

addCommandHandler ( "score", setScore )

See Also