PlayerRuleTriggered: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
(category)
 
Line 6: Line 6:


==Example==
==Example==
{{ClientsideCode|
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
  mp.events.add("playerRuleTriggered", (rule, counter) =>
mp.events.add("playerRuleTriggered", (rule, counter) =>
  {
{
let color = counter > 20 ? "red" : (counter > 10 ? "yellow" : "green");
let color = counter > 20 ? "red" : (counter > 10 ? "yellow" : "green");
mp.gui.chat.push(`Warning: {${color}}Your ${rule} is bad.`);
mp.gui.chat.push(`Warning: {${color}}Your ${rule} is bad.`);
  });
});
</syntaxhighlight>
</syntaxhighlight>
}}


==See also==
[[Category:Player]]
[[Category:Player Events API]]
[[Category:Client-side Event]]

Latest revision as of 11:09, 30 April 2019

This event is triggered when server rule check failed for local player.

Parameters

  • rule - name of rule
  • counter - counter of failed attempts

Example

Client-Side
mp.events.add("playerRuleTriggered", (rule, counter) =>
{
	let color = counter > 20 ? "red" : (counter > 10 ? "yellow" : "green");
	mp.gui.chat.push(`Warning: {${color}}Your ${rule} is bad.`);
});