So i'm having problems with adding points to a player using this point system: [url]https://github.com/adamdburton/pointshop[/url]
Here's my current code:
if SERVER then
function GM:PlayerDeath( victim, inflictor, attacker )
if ( victim == attacker ) then
PrintMessage( HUD_PRINTTALK, victim:Name() .. " committed suicide." )
else
PrintMessage( HUD_PRINTTALK, victim:Name() .. " was killed by " .. attacker:Name() .. "." )
attacker:PS_GivePoints(75)
attacker:PS_Notify('You have earned 75 points for killing ' victim)
end
end
end
If you could help that would be great thanks.
[lua]if SERVER then
function GM:PlayerDeath(victim, inflictor, attacker)
if victim == attacker then
PrintMessage( HUD_PRINTTALK, victim:Name() .. " committed suicide." )
else
PrintMessage( HUD_PRINTTALK, victim:Name() .. " was killed by " .. attacker:Name() .. "." )
attacker:PS_GivePoints(75)
attacker:PS_Notify("You have earned 75 points for killing " .. victim:Name())
end
end
end[/lua]
What you did wrong:
- You did not use the concatenation operator (..)
- You tried to use an Entity as string, which doesn't work. victim:Name() is what you're looking for.
ok
[editline]3rd July 2014[/editline]
[QUOTE=Cyberuben;45277635][lua]if SERVER then
function GM:PlayerDeath(victim, inflictor, attacker)
if victim == attacker then
PrintMessage( HUD_PRINTTALK, victim:Name() .. " committed suicide." )
else
PrintMessage( HUD_PRINTTALK, victim:Name() .. " was killed by " .. attacker:Name() .. "." )
attacker:PS_GivePoints(75)
attacker:PS_Notify("You have earned 75 points for killing " .. victim:Name())
end
end
end[/lua]
What you did wrong:
- You did not use the concatenation operator (..)
- You tried to use an Entity as string, which doesn't work. victim:Name() is what you're looking for.[/QUOTE]
I think that there might be something else wrong because when i use the code you gave me it didn't load sorry if i'm being dumb i'm new to gmod coding
Sorry, you need to Log In to post a reply to this thread.