AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help me with this please... (https://forums.alliedmods.net/showthread.php?t=22006)

SweatyBanana 12-16-2005 11:28

Help me with this please...
 
I found this, and i want to make it admin only...i dont know if i put everything in the right spot...can you help me?

I need it to show only when admin connects or leaves...

Code:
#include <amxmisc> #include <amxmodx> #include <cstrike> public client_putinserver(id) {     if(!(get_user_flags(id) & ADMIN_RESERVATION))         return PLUGIN_CONTINUE     new UserName[33]     get_user_name(id, UserName, 32)     new message[64] format(message,63,"%s has joined the game!",UserName)     set_hudmessage(100, 100, 100, 0.7, 0.02, 0, 6.0, 12.0, 1.0, 1.0, 1) show_hudmessage(0,message) } public client_disconnect(id) {     new UserName[33]     get_user_name(id, UserName, 32)     new message[64] format(message,63,"%s has left the game!",UserName)     set_hudmessage(100,100,100, 0.7, 0.06, 0, 6.0, 12.0, 1.0, 1.0, 1) show_hudmessage(0,message) } public plugin_init() {     register_plugin("Admin-Connect-Disconnect","1.0","cTn Edit by SweatyBanana") }   return PLUGIN_CONTINUE; }

Brad 12-16-2005 11:51

So what's the problem?

It appears that it will only work for admins on connect. Make it do the same for disconnect.

Also, if that's the entirety of the plugin, why in the name of your favorite God's name, are you including cstrike?

SweatyBanana 12-16-2005 11:55

It wont compile...can u plz fix my code?

I dont know...it wouldnt compile, then i included cstrike and it didnt show any errors, but then it only said

Quote:

Your plugin failed to compile! Read the errors below:




Plugin short name:
#include <amxmisc>
#include <amxmodx>
#include <cstrike>

public client_putinserver(id)
{
if(!(get_user_flags(id) & ADMIN_RESERVATION))
return PLUGIN_CONTINUE

new UserName[33]
get_user_name(id, UserName, 32)
new message[64] format(message,63,"%s has joined the game!",UserName)
set_hudmessage(100, 100, 100, 0.7, 0.02, 0, 6.0, 12.0, 1.0, 1.0, 1) show_hudmessage(0,message)
}
public client_disconnect(id)
{
new UserName[33]
get_user_name(id, UserName, 32)
new message[64] format(message,63,"%s has left the game!",UserName)
set_hudmessage(100,100,100, 0.7, 0.06, 0, 6.0, 12.0, 1.0, 1.0, 1) show_hudmessage(0,message)
}
public plugin_init()
{
register_plugin("Admin-Connect-Disconnect","1.0","cTn Edit by SweatyBanana") }

return PLUGIN_CONTINUE;
}


Brad 12-16-2005 11:59

No, I won't. You do it.

Code:
register_plugin("Admin-Connect-Disconnect","1.0","cTn Edit by SweatyBanana") }
There's an error on that line.

teame06 12-16-2005 13:21

I'll point you to the way....

You got to use a get_players, a for statement, show_hud(id, message)

Brad 12-16-2005 14:15

Quote:

Originally Posted by teame06
You got to use a get_players, a for statement

Lies! He wants it to show to everyone, not just admins.

XxAvalanchexX 12-16-2005 21:09

You don't need to include cstrike.

You make two statements on the same line without a semicolon (declaration of the message variable and formatting it).

You do this again (setting the hud message and showing it).

You do this two more times (second function, same places).

You have an extra curly brace on the register_plugin line.


All times are GMT -4. The time now is 16:08.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.