Raised This Month: $ Target: $400
 0% 

Bad Load - I can't see the reason


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smdobay
Member
Join Date: Feb 2005
Old 04-27-2005 , 01:08   Bad Load - I can't see the reason
Reply With Quote #1

I can't figure out why I'm getting a bad load. It's probably a small trivial mistake I overlooked but I've gone over everything many times.

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <engine> public plugin_init(){     register_plugin("SpawnMoney","1.0","smdobay")     register_cvar("sv_spawnmoney","10",FCVAR_SPONLY)         set_task(0.5,"givemoney")         return PLUGIN_HANDLED } public givemoney(){     for (new i=0;i<=32;i++) {         cs_set_user_money(i,cs_get_user_money(i) + get_cvar_num("sv_spawnmoney"))     }         set_task(0.5,"givemoney")         return PLUGIN_HANDLED }
smdobay is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 04-27-2005 , 01:14  
Reply With Quote #2

Quote:
set_task(0.5,"givemoney")
i'm not sure but i don't think you want to do that in init. So are you trying to give money when the round starts?
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 04-27-2005 , 11:32   Re: Bad Load - I can't see the reason
Reply With Quote #3

The main reason I think it fails to load is because you are trying to assign money to players that don't exist, and most importantly, you are doing it as soon as the plugin is initialized, and there will be 0 players in the server at that point..

You see, you are trying to give money to every player every 1/2 second, but you aren't checking if the player even exists!! I hope you understand what I mean..

Now, I am guessing that you want to give players money every time they spawn, is this correct?? You could just hook the ReseyHUD event, and then give players money there.. like:

Code:
#include <amxmodx> #include <cstrike> // Return values are ignored by this forward-function.. public plugin_init(){     register_plugin("SpawnMoney","1.0","smdobay")         // The "b" flag means that this event will be called for each player         register_event( "ResetHUD",  "Event_ResetHUD",  "b" )         //  Only 10 dollars??     register_cvar("sv_spawnmoney","10",FCVAR_SPONLY) } public Event_ResetHUD( id ) {         if( !is_user_alive( id ) )             return PLUGIN_CONTINUE         cs_set_user_money( id, cs_get_user_money(id) + get_cvar_num("sv_spawnmoney") )         return PLUGIN_CONTINUE }

Maybe something like that??
xeroblood is offline
Send a message via MSN to xeroblood
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-27-2005 , 13:18  
Reply With Quote #4

Would it really cause a bad load by trying to give money to players that don't exist, or simply runtime errors? Make sure that the cstrike module is enabled as well.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 04-27-2005 , 18:05  
Reply With Quote #5

Actually, I think you're right Avalanche, that possibility slipped my mind..
But either way, his method was a bad idea, I just assume () people have the modules working before trying to code with them..

So when ya gonna move outta your cardboard box?
xeroblood is offline
Send a message via MSN to xeroblood
smdobay
Member
Join Date: Feb 2005
Old 04-28-2005 , 13:49  
Reply With Quote #6

Actually, the idea here is to give a player just a few $ every half second, not on respawn. I already wrote a plugin for that.
Thanks for reminding me to check if they're alive
Still, I wouldn't think that would cause a bad load.

[Edit]I figured it out. There was a small typo in the cs module in modules.ini. Thanks av.[/Edit]
smdobay 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 16:44.


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