Donator Amor

How can I make that people who have the Donator Rang get 50 Amor?

In a

GM:PlayerSpawn

hook.Add, check the player’s rank with

Entity:GetNWString and then

Player:SetArmor

Yes but where do I have to type it?

I’ve always prefered notepad++ but really any text editor will do :v:

I mean in jobs.lua or …?? xD

I need to type it on any File or not?

Put it in a new file in lua/autorun/server.

ok thankyou!

[editline]9th December 2016[/editline]

hmm i dont understand the tutorials xD

can you make me a code pls that donator have 50 amor pls

Try using the links I provided; post your attempt here and we can correct it.

ok

[editline]9th December 2016[/editline]

I think its really bad xD

GM:PlayerSpawn( Player player )
hook.add(“PlayerSpawn”)
GetNWString( “Donator” )
ply:SetAmor(100)

sry but I am new at GLua or Lua

[editline]9th December 2016[/editline]

what is with this?

if
usergroup==“Donator”
ply:SetAmor(100)
end

hook.Add replaces the GAMEMODE override, which means you can do hook.Add( “PlayerSpawn”, … ) instead. Also, GetNWString is a player function. There’s an example at the bottom of the wiki page on how to get usergroups.

For example,


hook.Add("PlayerSpawn, "DonatorArmour", function(ply)
   -- Check the usergroup case-insensitive
   if (ply:GetNWString("usergroup"):lower() == "donator") then
      -- Set the armour here
   end
end)

hook.Add("PlayerSpawn, “DonatorArmor”, function(ply)
– Check the usergroup case-insensitive
if (ply:GetNWString(“usergroup”):lower() == “donator”) then
ply:SetAmor(100)
end
end)

is this right?

[editline]9th December 2016[/editline]

hook.Add( “PlayerSpawn”, “DonatorAmor”, function( ply )
if (ply:GetNWString(“usergroup”):lower() == “donator”) then
ply:SetArmor( 50 )
end)

Your first code is correct, however, you spelled “Armor” incorrectly.

hmm does not work :C
I created a lua file called donator.lua in
lua/autorun/server

Still no amor as a donator

Can you post your exact code in


 tags?

What is Code tags?

[noparse]


Code here

[/noparse]


hook.Add("PlayerSpawn, "DonatorArmour", function(ply)
-- Check the usergroup case-insensitive
if (ply:GetNWString("usergroup"):lower() == "donator") then
ply:SetAmour(100)
end
end)

You’re missing a quote mark on the first line after PlayerSpawn

You still spelled “Armor” wrong, as well.

Ok I will try it

[editline]9th December 2016[/editline]

Doesnt work