Scripting/Squirrel/Events/Player/onPlayerScoreChange

From VC-MP Wiki

Jump to: navigation, search

This is called when player's score changes.

Syntax

function onPlayerScoreChange( player, oldScore, newScore )

Parameters

  • player - The pointer of the player
  • oldScore - Player's old score before the change
  • newScore - The current score

Example

This will remind the player if they got a negative score.

function onPlayerScoreChange( player, oldScore, newScore )
{
     if ( ( oldScore < newScore ) && ( newScore < 0 ) )
          MessagePlayer( "You got only " + newScore + " points. You disappoint me!", player );
}

Notes

The function MessagePlayer was used in in this example. More info about it in the corresponding page.

Related Events

Personal tools
squirrel scripting