Difference between revisions of "LUA:AddCoin"

m (Edited for simplicity (changed Spawn to Player)
 
(One intermediate revision by one other user not shown)
Line 8: Line 8:
 
|Example =
 
|Example =
 
<pre>
 
<pre>
function hailed(NPC, Spawn)
+
function hailed(NPC, Player)
     if IsPlayer(Spawn) then
+
     if IsPlayer(Player) then
         AddCoin(Spawn, 10)
+
         AddCoin(Player, 10)
 
         Say(NPC, "Here have some copper")
 
         Say(NPC, "Here have some copper")
 
     end
 
     end
Line 18: Line 18:
 
|Notes = Can only be use on a player.
 
|Notes = Can only be use on a player.
 
}}
 
}}
 
 
 
 
{{PageHeaderChild|LUA|AddCoin}}
 
 
= LUA Functions: AddCoin() =
 
Gives coins to the player
 
 
 
==== Syntax ====
 
AddCoin(param1, param2)
 
 
 
==== Parameters ====
 
; Required - ''param1'' (Spawn), ''param2'' (int32)
 
: ''param1'' is the player to add coins to
 
: ''param2'' is the amount of coins to add
 
 
 
==== Usage ====
 
<pre>
 
function hailed(NPC, Spawn)
 
    if IsPlayer(Spawn) then
 
        AddCoin(Spawn, 10)
 
        Say(NPC, "Here have some copper")
 
    end
 
end
 
</pre>
 
 
When the NPC is hailed it will give the player 10 copper
 
 
==== Notes ====
 
Can only be use on a player.
 

Latest revision as of 07:23, 7 February 2022


LUA:AllFunctions - AddCoin

Return to: LUA:AllFunctions | Tutorials | Portal | Forum | Project Manager | Bug Tracker


Add coins to the given spawn

Syntax

AddCoin(param1, param2)

Parameters

Required - param1 (Spawn), param2 (int32)
param1 is the player to add coins to
param2 is the amount of coins to add


Example

function hailed(NPC, Player)
    if IsPlayer(Player) then
        AddCoin(Player, 10)
        Say(NPC, "Here have some copper")
    end
end

When the NPC is hailed it will give the player 10 copper

Notes

Can only be use on a player.