Hello developers! I recently have been working with Basic Admin plugins. I decided to make a warning command but have run into an issue.
local Data = {...}
local remoteEvent = Data[1][1]
local pluginName = "warn"
local pluginPrefix = ":"
local pluginLevel = 0
local pluginDescription = "Warn users"
local pluginFunction = function(Args)
local Player = Args[1]
remoteEvent:FireClient(Player, 'Notif', 'System', 'You have been warned.', {'PM','System','You have been warned.', true})
end
pluginDescription = pluginName .. " " .. pluginDescription
return pluginName, pluginFunction, pluginLevel, pluginPrefix, {pluginName, pluginDescription}
end
return Plugin
The issue is the PM is not sending, only the Notif is sending.
If you know what is wrong, please let me know. (Reply to this post)
Iâm actually not sure if thatâs a real argument. Any PM using essentialsEvent (remoteEvent in your case) is automatically unable to be replied to. PM is the same as a small notification. A long time ago when I tried doing something that you did, it didnât work.
Iâm assuming the PM function doesnât work for Notif, as it generates a completely new notification (just like receiving a PM from another user), instead of immediately broadcasting the PM in the center.
This should work for you. Instead of using PMs, it just uses a Message.
remoteEvent:FireClient(Player,'Notif','System','You have been warned.',{'Message','System','You have been warned.'})
If you want to warn specific player(s), youâll have to add this inside the pluginfunction:
local Player = Args[1]
local Victims = returnplayers(Player,Args[3],Args[2]) if not Victims then return end -- this will ignore the command if you're not include the player(s).
for a,b in next,Victims do
remoteEvent:FireClient(b, 'Notif', 'System', 'You have been warned.',{})
Although, if you want to use a message instead of Notif, use this:
remoteEvent:FireClient(b, 'Message', 'System', 'You have been warned by ' .. Player.Name .. '.')
If you do not use this, it will only affects the command executor, not the victims.
Please make a new topic as this is outdated.
âWeâ means whether me or another person wanted to help you. I understand that you might one of new developers whoâre still learning. Thatâs why Devforum is here! Although, itâs not learning if we just show you the full script instead of teach you how to fix that.