I want to make palyers drop money in precentages(%) and disable kill option in console
8 replies, posted
Hi,
I want to make palyers drop money in precentages(%), how can I do that? can somebody send me be kind and send me a code and tell me where to place it?
Also, I want to disable kill option in console, how can I make it?
Thanks for help.
To disable kill in console, make this hook return false [url]http://wiki.garrysmod.com/page/GM/CanPlayerSuicide[/url]
care to elaborate on the percentage part?
also for your suicide issues:
[code]
hook.Add("CanPlayerSuicide", "disablesuicide", function()
return false;
end);
[/code]
[QUOTE=Invule;52509038]care to elaborate on the percentage part?
also for your suicide issues:
[code]
hook.Add("CanPlayerSuicide", "disablesuicide", function()
return false;
end);
[/code][/QUOTE]
For example, When I want a player to drop 20% of his cash, when a player dies and have 100,000$ on him, he will drop 20,000$.
when a player has 100$, he will drop 20$.
[editline]26th July 2017[/editline]
[QUOTE=Invule;52509038]care to elaborate on the percentage part?
also for your suicide issues:
[code]
hook.Add("CanPlayerSuicide", "disablesuicide", function()
return false;
end);
[/code][/QUOTE]
Where shall I put the suicide code? I dont know where to place it.
tnx for the help
Here is the money drop part:
[code]
hook.Add("PlayerDeath", "dropmoneyondeath", function(victim)
if (not IsValid(victim)) then return; end
--Get the 20% from the players wallet.
local amt = (0.20 * victim:getDarkRPVar("money"));
--Create a money bag on the players position with the amount we stored above.
DarkRP.createMoneyBag(victim:GetPos(), amt);
--Once we have successfully dropped the money we have to take the same amount from the players wallet.
victim:addMoney(-amt);
end);
[/code]
All of this plus the suicide part goes in lua/autorun/server
[QUOTE=Invule;52509117]Here is the money drop part:
[code]
hook.Add("PlayerDeath", "dropmoneyondeath", function(victim)
if (not IsValid(victim)) then return; end
--Get the 20% from the players wallet.
local amt = (0.20 * victim:getDarkRPVar("money"));
--Create a money bag on the players position with the amount we stored above.
DarkRP.createMoneyBag(victim:GetPos(), amt);
--Once we have successfully dropped the money we have to take the same amount from the players wallet.
victim:addMoney(-amt);
end);
[/code]
All of this plus the suicide part goes in lua/autorun/server[/QUOTE]
Thank you very much!!
I will try it right now
[QUOTE=Invule;52509117]Here is the money drop part:
[code]
hook.Add("PlayerDeath", "dropmoneyondeath", function(victim)
if (not IsValid(victim)) then return; end
--Get the 20% from the players wallet.
local amt = (0.20 * victim:getDarkRPVar("money"));
--Create a money bag on the players position with the amount we stored above.
DarkRP.createMoneyBag(victim:GetPos(), amt);
--Once we have successfully dropped the money we have to take the same amount from the players wallet.
victim:addMoney(-amt);
end);
[/code]
All of this plus the suicide part goes in lua/autorun/server[/QUOTE]
Thanks for help its working!!!
love you<3
HOW TO?
Dude, this thread is a year old and you ask "how to" even though the answer has been posted.
Sorry, you need to Log In to post a reply to this thread.