Need To Make VIP Get Custom Weapons DarkRP Server

Once upon a time, I made a DarkRP Server and in that server there was a VIP rank. Would there be a way for me to make anyone that is VIP spawn with the Spiderman Swep without having to become a VIP job?

Hook into the PlayerLoadout event, check the player’s rank, and give the weapon there.

Code, how could I do that? And btw I see you everywhere lol.

The wiki have the example, go check it out

where would I put all of this code though?

Serverside. If you don’t want to implement this in the gamemode, lua/autorun/server.

would I create a file itself or put it in another one? if someone could give me a complete guide of how to do this that would be noice.

Put in a new file. Give it an attempt and post your resulting code here.


local function onThink()
	print( "onThink has been called" )
end

hook.Add( "Think", "Some unique name", onThink )

function GM:PlayerLoadout( ply )
	ply:Give( "spiderman's_swep" )

	-- Prevent default Loadout.
	return true
end

print( Entity( 1 ):GetNWString( "vip" ) )

ply:Give( "spiderman's_swep" )

That’s all I know how to do lol

Use hook.Add on PlayerLoadout and run the function in there. Also, don’t override the default loadout:


hook.Add( "PlayerLoadout", "SpidermanGun", function( ply )
   if ( ply:GetNWString( "usergroup" ):lower() == "vip" ) then
      -- Give
   end
end )

sorry this is my other account but what is the exact code I put in the file sorry I am not very good with this stuff.

The code I gave you. Just add a ply:Give() call for the weapon in the if statement.

is this the right code?


hook.Add( "PlayerLoadout", "SpidermanGun", function( ply )
   if ( ply:GetNWString( "usergroup" ):lower() == "vip" ) then
      ply:Give( "spiderman's_swep" )
   end
end )

Try and see

I did it didn’t work

Are you sure that’s the correct SWEP name?

I went in game and copied the name its that

Put a print in the hook and check if it runs.

[editline]13th September 2016[/editline]

You can also try the PlayerSpawn hook instead if the gamemode overrided the GM function.

IDK what the hell you are talking about XD sorry

[editline]13th September 2016[/editline]

I just want to fix this lol I would love for it to work

Try changing PlayerLoadout to PlayerSpawn. If it still doesn’t work, you have the wrong SWEP name.