Attempting to notify a user that they are not a donator when picking a job
5 replies, posted
[CODE]function meta:ChangeTeam(t, force)
donatorteams = {TEAM_SWAT, TEAM_SWATCOMMAND, TEAM_HIT, TEAM_BMARKET, TEAM_AGENT}
if table.HasValue( donatorteams, t ) and !force and !self:IsUserGroup("donator") and !self:IsSuperAdmin() then
Notify(self, 1, 4, string.format("That class is Donator only! To become a donator class, ask an admin about donations."))
return
end[/CODE]
Notify doesn't seem to be working, but it doesn't give any errors. They simply try to change and nothing happens.
Did this break with Gm13, if so how would I fix it?
change notify on the 4th line to GAMEMODE:notify
[QUOTE=gravelhunter;38442518]change notify on the 4th line to GAMEMODE:notify[/QUOTE]
Nope, didn't work :/ Still just shows the user saying the job command.
since notify is a darkrp function its.. you know a darkrp problem and not a garrysmod one.
try updating your darkrp, i believe its fixed (unless a recent update has broken it). if it has been broken recently just use svn and get an earlier revision :D
still not working?
try using p:PrintMessage (enum, string) instead.
it will print a message (depending on the enum) to the chat. if you dont know enums use p:ChatPrint(string) it will work the same as the HUD_PRINTCHAT enum.
both methods are shared.
DarkRP has this functionality built in.
[lua]
TEAM_CITIZEN = AddExtraTeam("Citizen", {
color = Color(20, 150, 20, 255),
model = {
"models/player/Group01/Female_01.mdl",
"models/player/Group01/Female_02.mdl",
"models/player/Group01/Female_03.mdl",
"models/player/Group01/Female_04.mdl",
"models/player/Group01/Female_06.mdl",
"models/player/Group01/Female_07.mdl",
"models/player/group01/male_01.mdl",
"models/player/Group01/Male_02.mdl",
"models/player/Group01/male_03.mdl",
"models/player/Group01/Male_04.mdl",
"models/player/Group01/Male_05.mdl",
"models/player/Group01/Male_06.mdl",
"models/player/Group01/Male_07.mdl",
"models/player/Group01/Male_08.mdl",
"models/player/Group01/Male_09.mdl"
},
description = [[The Citizen is the most basic level of society you can hold
besides being a hobo.
You have no specific role in city life.]],
weapons = {},
command = "citizen",
max = 0,
salary = 45,
admin = 0,
vote = false,
hasLicense = false,
customCheck = function(ply)
return ply:IsUserGroup("donator")
end
})[/lua]
for example.
[CODE]
donatorteams = {TEAM_SWAT, TEAM_SWATCOMMAND, TEAM_HIT, TEAM_BMARKET, TEAM_AGENT}
if table.HasValue( donatorteams, t ) and !force and !self:IsUserGroup("donator") and !self:IsSuperAdmin() then
GAMEMODE:Notify(self, 1, 4, string.format("That class is Donator only! To become a donator class, ask an admin about donations."))
return false
end[/CODE]
Bing bang boom.
Make sure you are putting this in the proper section of your player.lua (inside function meta:ChangeTeam(t, force)) as this won't work otherwise. You will also need proper spacing. Let me know if you need extra help.
Sorry, you need to Log In to post a reply to this thread.