Basic Admin | Plugin Help

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)

2 Likes

May I ask what the last parameter, true, is used for? I don’t see any BoolValue being used in the example.

Alternatively, you can just send a PM. Like this:

remoteEvent:FireClient(Player,'PM','System','You have been warned.')

It works the same way.

I understand that, but I want the little notification to pop up. The true makes it so you cant reply to it. :smiley:

1 Like

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.

Okay, thank you I will remove that. Do you have an answer to the other question about how to make it with the notification?

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.'})

https://streamable.com/btv519

Okay thank you. I will try it. If I need further help I will be sure to let you know.

2 Likes

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.

8 Likes

What’s the full code for this?

This post is old; consider making a new post.

2 Likes

We’re not allowed to give “full” code here but teach you how to code or solve scripting problem.

3 Likes

Who is “we”? And, why’s that? :confused:

1 Like

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.

2 Likes