Raised This Month: $12 Target: $400
 3% 

Mario Coins


Post New Thread Reply   
 
Thread Tools Display Modes
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 12-02-2015 , 09:33   Re: Mario Coins
Reply With Quote #31

Quote:
Originally Posted by nikhilgupta345 View Post
You also define CoinIdle and CoinSpin, but they are never used.
it's just an enumeration.
Also plugin updated, and ready for approval.
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-04-2015 , 08:03   Re: Mario Coins
Reply With Quote #32

Ok, let's see:
  • It would be nice to add support for amxx 1.8.3. They added a MAX_PLAYERS define(the value is 32). You could check the amxx version and define only if <183..
  • You are using bacon_PlayerPreThink to show a message, that is too much. You can use a task at 1.0 seconds to do this, it will be enough.

As a suggestion, you could check if the files actually exist before precaching. If they don't, then don't precache the files, throw an error and pause the plugin.

Only this, from a quick glance. Moving back to new plugins.
__________________

Last edited by HamletEagle; 12-04-2015 at 08:03.
HamletEagle is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 12-04-2015 , 09:04   Re: Mario Coins
Reply With Quote #33

- Yes i am using prethink, but is not constantly spammed to show the hudmessage, it does have a delay, basically like a task that is repeating tons of times with the same delay
- I will update and tweak it as soon as i can, thanks for suggestions
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-04-2015 , 09:39   Re: Mario Coins
Reply With Quote #34

-Doesn't matter, you are still doing things that you can avoid. Please consider a task or a thinking entity, with the delay being 1.0
-You don't need to create two versions, just do:
PHP Code:
#if AMXX_VERSION_NUM < 183 
#define MAX_PLAYERS 32 
#endif 
.

More:
1.On line 171, I believe you don't need to set again bCountTokenCoins[id] to iMaxCoins, if you are in the if check the variable has the value already.
2.szFormatHUDMessage size is too much, you can lower this, I think 192 would be enough.
__________________

Last edited by HamletEagle; 12-04-2015 at 09:41.
HamletEagle is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 12-04-2015 , 09:52   Re: Mario Coins
Reply With Quote #35

code updated. also fixed some bugs.
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-04-2015 , 10:02   Re: Mario Coins
Reply With Quote #36

You forgot to add +1 here new bCountTokenCoins[ MAX_PLAYERS ];. About precache thing, ideally you should have a check for every particular file:
PHP Code:
if( file_existsgCoinModel )
{
    
precache_modelgCoinModel )
}

if(
file_existsgCoinGained ))
{
    
precache_soundgCoinGained )
}

etc 
Or at least for the model, sounds are not that critical.

In EVENT_TextMsg and LOG_RoundEnd use get_players to make a loop, it's a bit faster(trivial) and will always give an array of valid players. That way you won't need to check is_user_connected.
On 233 setting bCountTokenCoins[ id ] = iMaxCoins; it's useless.
Don't make a task for each player, set only one in plugin_init and inside it loop all players(get_players + for()) and show the message.

I have a question about mc_bodycoin cvar. You always create only one entity, no matter how this cvar is set.
__________________

Last edited by HamletEagle; 12-04-2015 at 10:03.
HamletEagle is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 12-04-2015 , 10:06   Re: Mario Coins
Reply With Quote #37

On your question about bodycoin. When the player touches the coin, receives the amount of coins set by cvar.

Quote:
Originally Posted by HamletEagle View Post
On 233 setting bCountTokenCoins[ id ] = iMaxCoins; it's useless.


1. No it's not. If you have maximum coins, remove the entity only and don't display any hud message.
2. get_players is bugged in the current amx version, +1 line to check if player is connected doesn't hurt. https://forums.alliedmods.net/showth...7719?p=1297719 ( why shall i force a user to download an additional plugin to fix a bug, when i added a single line for connection check? )
3. idea about file exists before precaching is quite useless tho, the server won't even start up if the model is missing anyway
__________________

Last edited by tuty; 12-04-2015 at 10:19.
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-04-2015 , 11:18   Re: Mario Coins
Reply With Quote #38

Quote:
Originally Posted by tuty View Post
On your question about bodycoin. When the player touches the coin, receives the amount of coins set by cvar.





1. No it's not. If you have maximum coins, remove the entity only and don't display any hud message.
2. get_players is bugged in the current amx version, +1 line to check if player is connected doesn't hurt. https://forums.alliedmods.net/showth...7719?p=1297719 ( why shall i force a user to download an additional plugin to fix a bug, when i added a single line for connection check? )
3. idea about file exists before precaching is quite useless tho, the server won't even start up if the model is missing anyway
1.I am not sure to understand:
PHP Code:
if( bCountTokenCoinsid ] == iMaxCoins )
{
    
set_peviEntitypev_flagsFL_KILLME ); 
    
bCountTokenCoinsid ] = iMaxCoins//this

    
return PLUGIN_CONTINUE;

If you are in the if check bCountTokenCoins[id] is already iMaxCoins, why setting again ? I am talking about the line I commented.

2.get_players, for what you need to do is working ok. The only problem is about "e" flag(team check), you don't do such things. Also the plugin is unapproved for a reason, the bug about team check is fixed.

3.If you put the plugin and restart, you will get a crash if the model is missing, and you could lose players. If you don't precache then nothing wrong will happen. That was not a requierement, just a nice thing you could do.

Starting the task in init(thus making only one and not 32) was a requierement, also that way you won't need to remove it.
__________________

Last edited by HamletEagle; 12-04-2015 at 11:21.
HamletEagle is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 12-04-2015 , 12:56   Re: Mario Coins
Reply With Quote #39

about that commented line. SHIT. i haven't paid attention wtf. indeed is useless. i'll update it as soon as possible. my bad Hamlet.
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Location: Siiiiiiiiuu
Old 12-04-2015 , 17:30   Re: Mario Coins
Reply With Quote #40

Quote:
Originally Posted by HamletEagle View Post
About precache thing, ideally you should have a check for every particular file:
PHP Code:
if( file_existsgCoinModel )
{
    
precache_modelgCoinModel )
}

if(
file_existsgCoinGained ))
{
    
precache_soundgCoinGained )
}

etc 
Or at least for the model, sounds are not that critical.
I never saw people telling to check if file exists to precache. It makes no sense, if you forget to put a file in your machine, then its better to server crash on map change and check logs than having crash in the middle of the game.

Edit:
I did a short search for file_exist and the only thing i found was arkshine telling you to do so at your replacement plugin. If that's why you think it's a nice thing to do, they are different cases. At your plugin you touch directly the memory so it will be ok to not precache, but here he will still set the model even not precaching. So, for him to check if file exists, he would need also to stop the plugin and create a log saying wich files are missing. Better than precache right away but it's kinda pointless. If the user is noob he may learn at first because would still experience this crash with other plugins.

Last edited by Jhob94; 12-04-2015 at 22:10.
Jhob94 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:11.


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