Raised This Month: $ Target: $400
 0% 

Why doesn't


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 03-17-2005 , 13:24   Why doesn't
Reply With Quote #1

Hello
I'm trying to learn some small now and I have made a little stupid plugin just to learn but I can't get it to work
Here is the code, please can anyone say what I have done wrong and dont just say bla bla, please show me with code so I know the next time.

Code:
#include <amxmodx> #include <fun>   public plugin_init() {   regester_plugin("God in Server", "1.0", "NiGHTFiRE")   regester_cvar("amx_god")     }     public client_putinserver(id)  {      if (get_cvar_num("amx_god") > 0)      {           set_user_godmode(id, get_cvar_num("amx_god"))           } else {           set_user_godmode(id, get_cvar_num("mp_god"))                    } }
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-17-2005 , 13:33  
Reply With Quote #2

Quote:
#include <amxmodx>
#include <fun>

public plugin_init()
{

regester_plugin("God in Server", "1.0", "NiGHTFiRE")
regester_cvar("amx_god")

}

public client_putinserver(id)
{
if (get_cvar_num("amx_god") > 0)
{
set_user_godmode(id, get_cvar_num("amx_god"))
} else {
set_user_godmode(id, get_cvar_num("mp_god"))

}
}
Where to begin.... first off, there is no "mp_god" cvar. Second off, your else is in the wrong indent, which is not too bad, but still pretty stupid.

Third, you spelled "register" "regester"
Fourth, you did not give the cvars default values.

Five your using fun, whats up with that?

Heres mine:

Code:
#include <amxmodx> #include <fun> public plugin_init() {     register_plugin("God in Server", "0.1", "Mel")     register_cvar("amx_god","0")     register_cvar("mp_god","0")   }       public client_putinserver(id) {     if (get_cvar_num("amx_god") == 0) set_user_godmode(id, get_cvar_num("amx_god"))     else set_user_godmode(id, get_cvar_num("mp_god")) }

Or, my FM alternative:

Code:
#include <amxmodx> #include <fakemeta> #define set_user_godmode(%1,%2) set_pev(%1,pev_takedamage,%2*2) #define get_user_godmode(%1) (pev(%1,pev_takedamage) ) public plugin_init() {     register_plugin("God in Server", "0.1", "Mel")     register_cvar("amx_god","0")     register_cvar("mp_god","0")   }       public client_putinserver(id) {     if (get_cvar_num("amx_god") == 0) set_user_godmode(id, get_cvar_num("amx_god"))     else set_user_godmode(id, get_cvar_num("mp_god")) }

Try spelling the damn natives right next time, k?
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 03-17-2005 , 13:52  
Reply With Quote #3

LoL, man thanks, I don't understand how stupid I can be some times
But one thing I don't understand is why did you add

register_cvar("mp_god", "0") and why did you add "0" after amx_god as well?
What does this do?
Code:
#define set_user_godmode(%1,%2) set_pev(%1,pev_takedamage,%2*2) #define get_user_godmode(%1) (pev(%1,pev_takedamage) )

I thought i would need to use fun bc set_user_godmode is ni the fun.inc
Sorry that I'm noob.
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-17-2005 , 15:48  
Reply With Quote #4

Quote:
Originally Posted by NiGHTFiRE
LoL, man thanks, I don't understand how stupid I can be some times
But one thing I don't understand is why did you add

register_cvar("mp_god", "0") and why did you add "0" after amx_god as well?
What does this do?
Code:
#define set_user_godmode(%1,%2) set_pev(%1,pev_takedamage,%2*2) #define get_user_godmode(%1) (pev(%1,pev_takedamage) )

I thought i would need to use fun bc set_user_godmode is ni the fun.inc
Sorry that I'm noob.
You used mp_god, but did not register it. You registered amx_god.
You must give a cvar a default value, thus the 0.

those defines make FM defines of FUN stock, set_user_god and get_user_god. I hate FUN, so I made a list of stocks to replace its functions.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 03-18-2005 , 09:51  
Reply With Quote #5

ok thanx man, I have made a new plugin with almost the same code. Do you think I scripted this bad or good and if bad what should i do better?
Code:
#include <amxmodx> #include <fakemeta> #define set_user_health(%1,%2) set_pev(%1,pev_takedamage,%2*2) #define get_user_health(%1) (pev(%1,pev_takedamage) ) public plugin_init() {     register_plugin("Health in Server", "01", "NiGHTFiRE")     register_cvar("amx_health","0")     register_cvar("mp_health","0")   }       public client_putinserver(id) {     if (get_cvar_num("amx_health") == 0) set_user_health(id, get_cvar_num("amx_health"))     else set_user_health(id, get_cvar_num("mp_health")) }

The meaning of this code is to get the player when he joins to get tha mopunt of hp you have set with amx_health
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-18-2005 , 12:09  
Reply With Quote #6

Twilight u were really stupid for using FM. The kid is a newb and now u got him even more confused. Next time keep ur preferences and likes to yourself
Freecode is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-18-2005 , 15:35  
Reply With Quote #7

What, is it my fault for thinking fun module is a waste of perfectly good CPU and memory?

Look at the attached file. I converted every function from fun but give_item (which I can do, just lazy) and hitzones, to FM. I could do it to engine just as easily.

Why do we still have fun module then, when we could replace it with a stock file, and move the rest of its functions to core or to engine? Its archaic.
Attached Files
File Type: inc fun_stocks.inc (2.5 KB, 133 views)
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
LynX
Veteran Member
Join Date: Oct 2004
Old 03-18-2005 , 17:43  
Reply With Quote #8

Maybe your right - but FakeMeta isn't really a tool for newbies to play with.
I agree that its using CPU w/o any reason if theres only one set_user_godmode or set_user_health native - but its made as its made. I think it shouldn't be replaced so easily, and if some1 wants to save CPU time, go ahead.

P.S.

THNX for the stocks ! ;)
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-18-2005 , 22:06  
Reply With Quote #9

Quote:
Originally Posted by Twilight Suzuka
What, is it my fault for thinking fun module is a waste of perfectly good CPU and memory?

Look at the attached file. I converted every function from fun but give_item (which I can do, just lazy) and hitzones, to FM. I could do it to engine just as easily.

Why do we still have fun module then, when we could replace it with a stock file, and move the rest of its functions to core or to engine? Its archaic.
i understand that but thats not what the guy asked. u just made him so confused
Freecode is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-18-2005 , 22:36  
Reply With Quote #10

Yeah. Ok. But that's not really my fault.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
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 14:12.


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