General > Developers Corner

How to add weapons or more hp to a Rank User ?

<< < (2/4) > >>

Schiaffino:
Sorry for doble post , but other way is that when the user get Rank Example: 5 change his group to Regular User like the APromote.

and then i just edit the    if ply:IsUserGroup("regular")  with this...

There is a posibility ? if you need the code i can give it to you in PM.

:) please =)

MrPresident:
okay then the code I posted is the right format. Just have something like this...


--- Code: ---function CustomSpawn(ply)
     if ply:GetRank() == 1 then
          ply:Give("whatever weapon")
          ply:SetMaxHealth(some number here)
     elseif ply:GetRank() == 2 then
          ply:Give("whatever weapon")
          ply:SetMaxHealth(some number here)
     elseif ply:GetRank() == 3 then
          ply:Give("whatever weapon")
          ply:SetMaxHealth(some number here)
     elseif ply:GetRank() == 4 then
          ply:Give("whatever weapon")
          ply:SetMaxHealth(some number here)
     elseif ply:GetRank() == 5 then
          ply:Give("whatever weapon")
          ply:SetMaxHealth(some number here)
     end
end
hook.Add( "PlayerSpawn", "CustomSpawn", CustomSpawn )

--- End code ---

and so on... remember to set the weapon and health to what you want.

Schiaffino:
Mr sorry for this stupid question but i add your code to the sv_gamemode_functions.lua or in the same Timer system ?

MrPresident:
create a new file called (whatever).lua and put the code in that. Place that file in your garrysmod/lua/autorun/server folder.

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given

[0] Board index

Go to full version