Experience System

I got this addon for my server but thanks to garrysmod.org not letting me on i cant put up a link right now
but once i can get on i will… But basically i got an addon that has leveling, experience, etc…

I wanted to add my own little dark rp twist to it
so basically i need a little help with some code
I want it to be where if a cop arrest someone they gain exp
(I KNOW THIS ISNT CORRECT)


if(the players job == TEAM_POLICE || the players job == TEAM_CHIEF) then
	if(however i would call the using arrest baton) then
		players xp =+ 50;
	end
end

this is how the addon gives you more xp for shooting from a distance


if killer:GetPos():Distance(victim:GetPos())>1500 then //Distance kill
			killer:GiveXP(50,"Sharpshooter","gui/longshot")
		end

Btw, the GUI’s arent working correctly, i tried changing it to materials/gui/…
but still wont work but back to the original topic so how could i make it give xp to a person?
I also wanted to know how could i make it where

if(myplayerslevel >= 10) then
myplayersrunspeed == 700;
end

ive thought of ways i could possibly attempt this with dark rp but i think if i where to do
rp_runspeed == 700 that it would make everyones speed 700? true or false?

All help is appreciated
Thanks, Nynex

-nvm-

[lua]
–Use this in your level up function.
player:SetRunSpeed(700);
[/lua]

You could also edit your arrest baton and look for the SWEP:PrimaryAttack func and integrate your experience system. Also, you can’t do math like:
[lua]
num = +50
–You must do this.
num = num + 50
[/lua]

Look for the function where when cops arrest someone it sets there position etc, then simply just add

[lua]ply:GiveXP(50)[/lua]

For the runspeed I’m not sure what the define is

[lua]
if(self.profData.Level >= 10) then
ply:SetRunSpeed(700);
end
[/lua]

Again, I don’t know the [lua]self.profData.Level[/lua] is for you, this is out of my own level system. I do remember seeing the level system you are using however cannot get to it due to garrysmod.org being down. I would imagine it’s using SetNWInt to store the level values.

Adding XP to arrests would just make people run around randomly arresting people more than they already do…

But just add self.Owner:GiveXP(50, “Arrested”, “material/here”) to the swep fire function, assuming the second arg is just used for a notification.

As for GUI not working, you probably just don’t have the material on the client.