AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Pre-name defining (https://forums.alliedmods.net/showthread.php?t=172821)

ingmar13 11-26-2011 11:33

Pre-name defining
 
PHP Code:

public commandid )
{
    new const 
sPrename[] = "[lametext]";
    
//randomcommands
    
    
client_printidprint_chat"%s subtext: %s",sPrename); 



How to put this above i tried

const sPrename[] = "[lametext]";

it had a lot of issues..

kramesa 11-26-2011 11:35

Re: Pre-name defining
 
What? Is this?

PHP Code:

#define sPrename "[lametext]"

public command(id)
{
    
client_print(idprint_chat"%s"sPrename)



ingmar13 11-26-2011 11:39

Re: Pre-name defining
 
PHP Code:

#include <amxmodx>
#include <fun>

#define PLUGIN_NAME    "mGodmode"
#define PLUGIN_VERSION    "1.0"
#define PLUGIN_AUTHOR    "Malle"

const FLAG_GODMODE = (<< 0);

new 
g_iFlags[33];

public 
plugin_init( )
{
    
register_plugin"mGodmode""1.0""Malle" )
    
register_clcmd"say /god""cmdgod" )
    
register_clcmd"say /godmode""cmdgod" )
}

public 
client_disconnect(iPlayer)
{
    
g_iFlags[iPlayer] = 0;
}

public 
cmdgodid )
{
    new const 
sPrename[] = "[mGod]";
    
g_iFlags[id] ^= FLAG_GODMODE;
    
    
client_printidprint_chat"%s Yo DAWG you turned your godmode: %s",sPrenameg_iFlagsid ] & FLAG_GODMODE "On" "Off" );
    
    
set_user_godmodeid, !!( g_iFlagsid ] & FLAG_GODMODE) );
    
    return 
PLUGIN_HANDLED;


i got this code but i want the prename to be a head structure like
const FLAG_GODMODE = (1 << 0); is.. how ?



Oh..

solution:

PHP Code:

#include <amxmodx>
#include <fun>

#define PLUGIN_NAME    "mGodmode"
#define PLUGIN_VERSION    "1.0"
#define PLUGIN_AUTHOR    "Malle"

const FLAG_GODMODE = (<< 0);

new 
g_iFlags[33];
new const 
sPrename[] = "[mGod]";

public 
plugin_init( )
{
    
register_plugin"mGodmode""1.0""Malle" )
    
register_clcmd"say /god""cmdgod" )
    
register_clcmd"say /godmode""cmdgod" )
}

public 
client_disconnect(iPlayer)
{
    
g_iFlags[iPlayer] = 0;
}

public 
cmdgodid )
{
    new const 
sPrename[] = "[mGod]";
    
g_iFlags[id] ^= FLAG_GODMODE;
    
    
client_printidprint_chat"%s Yo DAWG you turned your godmode: %s",sPrenameg_iFlagsid ] & FLAG_GODMODE "On" "Off" );
    
    
set_user_godmodeid, !!( g_iFlagsid ] & FLAG_GODMODE) );
    
    return 
PLUGIN_HANDLED;




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

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