Raised This Month: $32 Target: $400
 8% 

Money All-in-One (update 3.3)


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-18-2008 , 05:54   Re: Money All-in-One
Reply With Quote #21

That's not something you should be bothered. Between a safe-method which doesn't hurt at all ( for such ridiculous memory allocation ) and a non-safe method which you have to decrease each time the id, the first method is far more appropriate.
__________________
Arkshine is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 11-18-2008 , 06:15   Re: Money All-in-One
Reply With Quote #22

I guess it might take a little bit of getting used to, but it's worth it, even just so your code doesn't look retarded. I develop large applications in C++, I can't help but be concerned with memory usage.
Spunky is offline
Send a message via AIM to Spunky
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-18-2008 , 11:32   Re: Money All-in-One
Reply With Quote #23

About dynamic natives : http://forums.alliedmods.net/showthread.php?t=41251
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
[email protected]
Member
Join Date: Oct 2008
Location: China,Shanghai
Old 11-19-2008 , 07:15   Re: Money All-in-One
Reply With Quote #24

Quote:
Originally Posted by connorr View Post

My dear connorr, you are so HELPFUL!

Please accept my kiss~~~ obviously on face , haha :D
tomcash@263.net is offline
Send a message via MSN to tomcash@263.net
[email protected]
Member
Join Date: Oct 2008
Location: China,Shanghai
Old 11-19-2008 , 07:58   Re: Money All-in-One
Reply With Quote #25

arkshine and Spunky 's argument is interesting. (:

I adopted both of their suggestion and make a little update:

- Use #define to definite constant in evidence.
- Shrink some array's size for less memory usage.
- Dictionary file, add nl, es, fr language.


As I know, id in HL is 1 to 32, but array index start from 0 in Pawn.
So, I think array size should be 33 if the array deal with id.

Try this:
new name[32]
get_user_name(0, name, 31)

The name will be server hostname. (: So, g_array[32] not perfect sometimes.


It's time to go to bed.

Your day is coming, my day is over, see you 8 hours later.

Last edited by [email protected]; 11-19-2008 at 08:32.
tomcash@263.net is offline
Send a message via MSN to tomcash@263.net
DeuX
Member
Join Date: Apr 2008
Old 11-19-2008 , 18:49   Re: Money All-in-One
Reply With Quote #26

Plugin nice, we try this our servers, but have one trouble, when you give some peoples money than him drop some errors like that:

L 11/19/2008 - 11:27:47: [CSTRIKE] Invalid player 11
L 11/19/2008 - 11:27:47: [AMXX] Run time error 10 (plugin "money_naken_bonus.amxx") (native "cs_set_user_money") - debug not enabled!
L 11/19/2008 - 11:27:47: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).


If we enable debuging mode, i put new log events here....

But plugin nice, and this work
DeuX is offline
[email protected]
Member
Join Date: Oct 2008
Location: China,Shanghai
Old 11-19-2008 , 19:33   Re: Money All-in-One
Reply With Quote #27

Quote:
Originally Posted by DeuX View Post
Plugin nice, we try this our servers, but have one trouble, when you give some peoples money than him drop some errors like that:

L 11/19/2008 - 11:27:47: [CSTRIKE] Invalid player 11
L 11/19/2008 - 11:27:47: [AMXX] Run time error 10 (plugin "money_naken_bonus.amxx") (native "cs_set_user_money") - debug not enabled!
L 11/19/2008 - 11:27:47: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).


If we enable debuging mode, i put new log events here....

But plugin nice, and this work

I'm very glad to hear you have tried my plugin and feel nice.

This error log perhaps is caused by the plugin money_naken_bonus.amxx not my. I can't find money_naken_bonus.sma file, if you can provide it, I will figure it out. Thank you. (:
tomcash@263.net is offline
Send a message via MSN to tomcash@263.net
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 11-19-2008 , 21:05   Re: Money All-in-One
Reply With Quote #28

Quote:
Originally Posted by [email protected] View Post
Try this:
new name[32]
get_user_name(0, name, 31)

The name will be server hostname. (: So, g_array[32] not perfect sometimes.
What do you mean? It gets the server hostname because you passed the server's index. If you want to get the name of a player by their index index, you could do this.

PHP Code:
new szName[64]
new 
g_Array[32]
new 
iPlayerNum

// g_Array holds player indexes
// iPlayerNum holds the number of players
// "ch" tells the plugin to ignore bots and HLTV
get_players(g_ArrayiPlayerNum"ch")

for (new 
0iPlayerNumi++)
{
     
get_user_name(g_Array[i], szName63)

     
// Whatever you want done with the name here.

That fetches the index of every player in the server (excluding the server index), gets their names one at a time, and then does something...

See? Easy.
Spunky is offline
Send a message via AIM to Spunky
[email protected]
Member
Join Date: Oct 2008
Location: China,Shanghai
Old 11-19-2008 , 21:36   Re: Money All-in-One
Reply With Quote #29

Quote:
Originally Posted by Spunky View Post
What do you mean? It gets the server hostname because you passed the server's index. If you want to get the name of a player by their index index, you could do this.

PHP Code:
new szName[64]
new 
g_Array[32]
new 
iPlayerNum
 
// g_Array holds player indexes
// iPlayerNum holds the number of players
// "ch" tells the plugin to ignore bots and HLTV
get_players(g_ArrayiPlayerNum"ch")
 
for (new 
0iPlayerNumi++)
{
     
get_user_name(g_Array[i], szName63)[/i]
[
i][/i]
[
i]     // Whatever you want done with the name here.[/i]
[i]}[/i
[i]That fetches the index of every player in the server (excluding the server index), gets their names one at a time, and then does something...

See? Easy.

I got you idea fully. But you misunderstood me ( maybe cause by my poor English, hehe ) :

Like some variables directly solve id, e.g. g_client_money[id] in my plugin, if I definate g_client_money[32], when 32nd player enter, a fatal error will happen due to out of boundary.

Because the array g_client_money's argument end to 31, but player's id end to 32.

As far as I know. That's right? (:
tomcash@263.net is offline
Send a message via MSN to tomcash@263.net
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 11-19-2008 , 22:05   Re: Money All-in-One
Reply With Quote #30

Then rewrite it so that it won't. It's really not that hard. O_o

Edit: Here, look at this.

PHP Code:
new g_Array[32], g_iPlayerNum

public client_connect(id)
{
     if (
id <= g_iPlayerNum && id != 0)
          
g_client_connected[id] = 1

     
return PLUGIN_HANDLED

That's one thing you can do. There are infinite possibilities.

Last edited by Spunky; 11-19-2008 at 23:40.
Spunky is offline
Send a message via AIM to Spunky
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 22:33.


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