So when a donator spawns on the server he gets a knife
but how to do it iam using ulx
You dont need ULX for this.
Just watch in the PlayerSpawn hook and make a check if a User has the usergroup donator just like this
--This is the Table where u can define the Usergroups
allowedulxuser = {
"superadmin",
"donator",
"admin"
}
than use the PlayerSpawn hook like this:
--This is the PlayerSpawn hook it calls everytime a playerspawns
hook.Add("PlayerSpawn","gives knives on spawn to donator", function(ply)
if table.HasValue(allowedulxuser , ply:GetUserGroup()) then
ply:Give("knife")
end
end)
Replace knife with the weapon name... or u can use a extra function or can give them more than one knife weapon ...
where i have to put it?
Its a Serverside hook., Serverside means that the hook can only run by the Server thats why i prefer to put it in the autorun/server folder..
otherwise u can put it in the lua/autorun folder but i prefer that u define with
if SERVER then
----code-----
end
So and it needs to get loaded automatically.
So just put it in an addon like:
addons/knifesonspawn/lua/autorun/server/sv_hooks.lua
Sorry, you need to Log In to post a reply to this thread.