Raised This Month: $ Target: $400
 0% 

the most noob question EVER MADE


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
--kml--
Senior Member
Join Date: Jan 2009
Old 06-06-2009 , 00:10   the most noob question EVER MADE
Reply With Quote #1

the most noob question EVER MADE

xD
very noob question but i dunno how o.o
how to do an on an off? LOL

if i off it only off somethings but active something else

if i on it activate many things but didnt active something else.

like

amx_kml on

print at chat
execute command exit

amx_kml off

do not print at chat
execute command exit?

how to do something similar?

thx by --kml-- xD
__________________
wooT now is asking season
will ask you plenty of things for learning
--kml-- is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-06-2009 , 00:32   Re: the most noob question EVER MADE
Reply With Quote #2

PHP Code:
if(on)
{
    
// do something

You should try writing some code and see if you can get it to work. Then show us your code if it doesn't work. This is the way this forum works [the best].
__________________
fysiks is offline
--kml--
Senior Member
Join Date: Jan 2009
Old 06-06-2009 , 09:31   Re: the most noob question EVER MADE
Reply With Quote #3

THis is a plugin


PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>

#define PLUGIN     "Spin Me"
#define VERSION "1.0"
#define AUTHOR     "Charming"

new bool:on[33]
public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /on""cmdON")
    
register_clcmd("say /off""cmdOFF")
}

public 
cmdOFF(id)
{
    
on[id] = false
    client_cmd
(id"-right")
    
entity_set_float(idEV_FL_friction1.0)
    
entity_set_float(idEV_FL_gravity0.0)
}

public 
cmdON(idon[id] = true
public client_PreThink(id) if(on[id]) leEt_EfFeCt(id)

leEt_EfFeCt(id)
{
    
client_cmd(id"+right")
    if(
entity_get_int(idEV_INT_flags) & FL_ONGROUND)
    {
        new 
Float:Velocity[3]
        
entity_get_vector(idEV_VEC_velocityVelocity)
        
        
Velocity[0] = random_float(200.0500.0)
        
Velocity[1] = random_float(200.0500.0)
        
Velocity[2] = random_float(200.0500.0)
        
        
entity_set_vector(idEV_VEC_velocityVelocity)
    }

    
entity_set_float(idEV_FL_friction0.1)
    
entity_set_float(idEV_FL_gravity0.000001)

and it uses bool
how to do it.
i mean can seperate it ?
__________________
wooT now is asking season
will ask you plenty of things for learning
--kml-- is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-06-2009 , 12:39   Re: the most noob question EVER MADE
Reply With Quote #4

What you mean?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 06-06-2009 , 12:48   Re: the most noob question EVER MADE
Reply With Quote #5

I don't really see what you are trying to achieve. Making the player move to the left?
Since you are checking if the player is on the ground in prethink, the user will ALWAYS move to the left (if he's on the ground, of course).
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-06-2009 , 16:38   Re: the most noob question EVER MADE
Reply With Quote #6

i saw someone actually doing this

#define someVar

if some condition is true.

and then later do this
#if defined someVar
do something
#endif

i like this way of checking ons or offs better.
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-06-2009 , 16:40   Re: the most noob question EVER MADE
Reply With Quote #7

Those types of commads only work when compiling the plugin. It will not do anything when you are in the game. You use those to omit parts of your code from being put in the actual plugin.

EDIT: HAHA I beat Bugsy lol .
__________________
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-06-2009 , 16:40   Re: the most noob question EVER MADE
Reply With Quote #8

Quote:
Originally Posted by Atspulgs View Post
i saw someone actually doing this

#define someVar

if some condition is true.

and then later do this
#if defined someVar
do something
#endif

i like this way of checking ons or offs better.
Those are pre-compiler directives that only check the conditions at compile-time. They take no action on changes that happen while the plugin is running.
__________________
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-06-2009 , 16:42   Re: the most noob question EVER MADE
Reply With Quote #9

I'm give an example.
PHP Code:
#include <amxmodx>
#include <cstrike> 
#include <hamsandwich>
#include <fun>

// #define Rockie
#define Hillarious

new pCvarEnablepCvarHealthpCvarHealthAmountpCvarArmorpCvarArmorAmountpCvarMoneypCvarMoneyAmount;

public 
plugin_init() 
{
    
register_plugin ("Bonus""1.0""TitANious")
    
    
#if defined Rockie
    
pCvarEnable register_cvar "bonus_enable""1" )                                    
    
pCvarHealth register_cvar "bonus_health""1" )     
    
pCvarHealthAmount register_cvar "bonus_healthamount""30" )                      
    
pCvarArmor register_cvar "bonus_armor""1" )       
    
pCvarArmorAmount register_cvar "bonus_armoramount""30" )               
    
pCvarMoney register_cvar "bonus_money""1" )
    
pCvarMoneyAmount register_cvar "bonus_moneyamount""2000" )    
    
#endif
    
    
RegisterHam Ham_Spawn"player""fwHamPlayerSpawnPost")
}

#if defined Hillarious
public fwHamPlayerSpawnPost id 
{
    if ( ( 
get_pcvar_num pCvarEnable ) ) && ( is_user_alive(id) ) )
    {
        if ( 
get_pcvar_num pCvarHealth ) == )
        {
            
set_user_health idget_user_health id ) + get_pcvar_num pCvarHealthAmount )  )
        }
        if ( 
get_pcvar_num pCvarArmor ) == )
        {
            
set_user_armor idget_user_armor id ) + get_pcvar_num pCvarArmorAmount ) )
        }
        if ( 
get_pcvar_num pCvarMoney ) == )
        {
            
cs_set_user_money idcs_get_user_money id ) + get_pcvar_num pCvarMoneyAmount ) )
        }
    }
}
#endif 
Now the pcvars (That will make the plugin have warnings) don't work because Rockie ain't defined (I've commented it)
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.

Last edited by TitANious; 06-06-2009 at 17:43.
TitANious is offline
Send a message via MSN to TitANious
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-06-2009 , 16:51   Re: the most noob question EVER MADE
Reply With Quote #10

cool i should try that later
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
Reply


Thread Tools
Display Modes

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 13:50.


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