Raised This Month: $51 Target: $400
 12% 

Help with script |Connect Message|


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 09-07-2010 , 11:28   Help with script |Connect Message|
Reply With Quote #1

Hi,

Can someone help me with this?

It should announce a donater whene joining but not an admin whene joining (for undercover reasons)

Why doesnt this code works?

Plz keep in mind: I never ever coded something in my life, only copy pasted some things together

PHP Code:
#include <sourcemod>

#define PLUGIN_VERSION "0.0.3"
#define ADMIN_LEVEL ADMFLAG_CUSTOM6

public Plugin:myinfo 
{
        
name "AdminConnectmsg",
        
author "R-Hehl",
        
description "Shows players connecting admins",
        
version PLUGIN_VERSION,
        
url "http://www.compactaim.de/"
};
public 
OnPluginStart()
{
    
// Create the rest of the cvar's
    
CreateConVar("sm_admin_conmsg_version"PLUGIN_VERSION"Admin Connect MSG Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
}
public 
OnClientPostAdminCheck(client
{
    new 
flags GetUserFlagBits(client);
    if ((
flags ADMIN_LEVEL) && !(flags ADMFLAG_SLAY))
    {
              new 
String:name[32];
              
GetClientName(clientname32);
            
PrintCenterTextAll("Donater %s connected",name);
    } else if (
flags ADMFLAG_SLAY)
    {
   
//
    

    return 
true;

Groger is offline
API
Veteran Member
Join Date: May 2006
Old 09-07-2010 , 11:49   Re: Help with script |Connect Message|
Reply With Quote #2

I'm assuming the flag for slay is used to indicate a donation? However I think ur code doesnt work because the slay flag might set ADMIN_LEVEL automatically? (Since they are partially an admin since they can slay?)
Let me know if you can't figure this out with some simple debug messages.
__________________
API is offline
Send a message via AIM to API
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 09-07-2010 , 11:51   Re: Help with script |Connect Message|
Reply With Quote #3

I don't see anything wrong with the code, although I may be mistaken. Have you tried running just if ((flags & ADMIN_LEVEL)) and see if it works properly without checking for the slay flag? And on a side note, it's Donator, not Donater .
__________________
thetwistedpanda is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 09-07-2010 , 12:39   Re: Help with script |Connect Message|
Reply With Quote #4

Quote:
Originally Posted by thetwistedpanda View Post
I don't see anything wrong with the code, although I may be mistaken. Have you tried running just if ((flags & ADMIN_LEVEL)) and see if it works properly without checking for the slay flag? And on a side note, it's Donator, not Donater .
Yes but thats the problem, the flag t (custom6) is set to enable donatOrs to acces there special abbility's , and my admins have that flag to

So thats why && !(flags & ADMFLAG_SLAY)) is behind it.


So lets analyse it :

PHP Code:
#include <sourcemod> 

#define PLUGIN_VERSION "0.0.3" 
#define ADMIN_LEVEL ADMFLAG_CUSTOM6 // Here i set ADMIN_LEVEL to The flag "T"

public Plugin:myinfo =  

        
name "AdminConnectmsg"
        
author "R-Hehl"
        
description "Shows players connecting admins"
        
version PLUGIN_VERSION
        
url "http://www.compactaim.de/" 
}; 
public 
OnPluginStart() 

    
// Create the rest of the cvar's 
    
CreateConVar("sm_admin_conmsg_version"PLUGIN_VERSION"Admin Connect MSG Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 

public 
OnClientPostAdminCheck(client)  

    new 
flags GetUserFlagBits(client); 
    if ((
flags ADMIN_LEVEL) && !(flags ADMFLAG_SLAY)) // Everyone with the flag "T" but not with the "SLAY" flag
    

              new 
String:name[32]; 
              
GetClientName(clientname32); 
            
PrintCenterTextAll("Donater %s connected",name); 
    } else if (
flags ADMFLAG_SLAY// This is actually unnessecary, RIGHT? 
    

   
// 
    
}  
    return 
true

Quote:
Originally Posted by pimpinjuice View Post
I'm assuming the flag for slay is used to indicate a donation? However I think ur code doesnt work because the slay flag might set ADMIN_LEVEL automatically? (Since they are partially an admin since they can slay?)
Let me know if you can't figure this out with some simple debug messages.
Well as I said before, I NEVER ever coded something real, just copy pasted some stuff together, but if you wanna explain how I can debug this, be my guesst. I really wanna learn it
Uhm the slay flag is to determine the admins and the donators, cause my admins like I said before, have the donate flag "T" to



EDIT: Whene compiling this I get 1 warning but thats all, no description at all. Just : 1 Warning.

Also can you explain this: "return true;"

Last edited by Groger; 09-07-2010 at 12:48.
Groger is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 09-07-2010 , 12:53   Re: Help with script |Connect Message|
Reply With Quote #5

The warning is loose indentation.

And the second if, if you're not adding anything in it, is unnecessary, yeah.

And by 'not working' you probably mean it's not printing anything?
If so, it means you've probably designated the wrong flag to donators.

(PS: Why not just use ADMNFLAG_CUSTOM6, instead of defining it to something else?)

EDIT: No idea why the return's there. That forward doesn't need one.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 09-07-2010 , 13:24   Re: Help with script |Connect Message|
Reply With Quote #6

Exactly Its not printing out anything, no errors so i guess its working..

However my donators are clearly using the T flag to acces there donate abillity's.

So this should work?

PHP Code:
#include <sourcemod> 

#define PLUGIN_VERSION "0.0.3" 

public Plugin:myinfo =  

        
name "AdminConnectmsg"
        
author "R-Hehl"
        
description "Shows players connecting admins"
        
version PLUGIN_VERSION
        
url "http://www.compactaim.de/" 
}; 
public 
OnPluginStart() 

    
// Create the rest of the cvar's 
    
CreateConVar("sm_admin_conmsg_version"PLUGIN_VERSION"Admin Connect MSG Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 

public 
OnClientPostAdminCheck(client)  

    new 
flags GetUserFlagBits(client); 
    if ((
flags ADMFLAG_CUSTOM6) && !(flags ADMFLAG_SLAY)) // Everyone with the flag "T" but not with the "SLAY" flag
    

              new 
String:name[32]; 
              
GetClientName(clientname32); 
            
PrintCenterTextAll("Donater %s connected",name); 
    } 

If its not to mutch to ask can someone explain this word by word:

PHP Code:
 new flags GetUserFlagBits(client); 
    if ((
flags ADMFLAG_CUSTOM6) && !(flags ADMFLAG_SLAY)) // <-- I understand that almost, only the "flags &" part, why is it there? 
Groger is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 09-07-2010 , 13:53   Re: Help with script |Connect Message|
Reply With Quote #7

'&' is a bitwise operator.
It checks if a certain bit (ADMFLAG_CUSTOM6 for example) is set to 1.

And just for debugging, try running it without "&& !(flags & ADMFLAG_SLAY)"
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 09-07-2010 , 14:23   Re: Help with script |Connect Message|
Reply With Quote #8

Sorry m8 the script works fine now, weird ..

this is the working version if someone would mind:

PHP Code:
#include <sourcemod>  

#define PLUGIN_VERSION "0.0.3"  

public Plugin:myinfo =   
{  
        
name "AdminConnectmsg",  
        
author "R-Hehl",  
        
description "Shows players connecting admins",  
        
version PLUGIN_VERSION,  
        
url "http://www.compactaim.de/"  
};  
public 
OnPluginStart()  
{  
    
// Create the rest of the cvar's  
    
CreateConVar("sm_admin_conmsg_version"PLUGIN_VERSION"Admin Connect MSG Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);  
}  
public 
OnClientPostAdminCheck(client)   
{  
    new 
flags GetUserFlagBits(client);  
    if ((
flags ADMFLAG_CUSTOM6) && !(flags ADMFLAG_SLAY)) // Everyone with the flag "T" but not with the "SLAY" flag 
    
{  
              new 
String:name[32];  
              
GetClientName(clientname32);  
            
PrintCenterTextAll("Donater %s connected",name);  
    }  

Thx for the explanation Monkeys, and everyone else thx for helping

Greetz
Groger is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 09-07-2010 , 14:27   Re: Help with script |Connect Message|
Reply With Quote #9

Sorry for double post but one small question remains ^^

Is it possible to change PrintCenterTextAll to PrintHintTextAll Cause I get errors on compiling if I use : PrintHintTextAll
Also can you choose the duration of the message? so it should be up 5 seconds?
Groger is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 09-07-2010 , 14:45   Re: Help with script |Connect Message|
Reply With Quote #10

PrintHintTextToAll

Not sure about duration.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:28.


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