General > Developers Corner
GM, Credit help.
(1/1)
IizStormViper:
So I'm starting to make my own gamemode that has credits.So I was wondering if anyone could help me. I'm trying to make a custom credit system.This is what I have so far will this work if I add a loop and make it so the person that kills someone gets more credits everytime they get killed.
--- Code: ---credit = 0
function GM:PlayerInitialSpawn(ply)
if credit = 0 then
credit = 1.5 else
if credit = getcredit then
credit + 1.5
end
end
concommand.Add("credit", credit)
--- End code ---
edit: I know that it is on spawn, its only being tested at the moment.
Assault_Trooper:
--- Quote from: IizStormViper on July 08, 2012, 01:12:26 PM ---So I'm starting to make my own gamemode that has credits.So I was wondering if anyone could help me. I'm trying to make a custom credit system.This is what I have so far will this work if I add a loop and make it so the person that kills someone gets more credits everytime they get killed.
--- Code: ---credit = 0
function GM:PlayerInitialSpawn(ply)
if credit = 0 then
credit = 1.5 else
if credit = getcredit then
credit + 1.5
end
end
concommand.Add("credit", credit)
--- End code ---
edit: I know that it is on spawn, its only being tested at the moment.
--- End quote ---
I don't even understand how that code is related to your description. I honestly don't think you should be making a gamemode since you don't really have the skills to make one.
You have to use the PlayerDeath( ply, weapon, killer ) hook. And you need to store the credits on the players, ply:SetNWInt( "credits", 1 ) or in a table.
MrPresident:
Not to sound rude, but everything about the code you posted is wrong. Nothing will work in that.
If you can tell me what you want it to do clearly, I will help you out.
Navigation
[0] Message Index
Go to full version