Raised This Month: $ Target: $400
 0% 

Please review my plugin, Any room for improvements?


Post New Thread Reply   
 
Thread Tools Display Modes
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 07-24-2013 , 08:20   Re: Please review my plugin, Any room for improvements?
Reply With Quote #11

Quote:
Originally Posted by devWaleed View Post
I observed the /afk problem, It can only be used by 1 player at a time. I am new with arrays in amxx. So I need a little help.

I will have to do
PHP Code:
new teams[32]; 
Then save players id and team like this.
PHP Code:
teams[id] = get_user_team(id); 
and later, call it as required.
PHP Code:
cs_set_user_team(idteams[id]); 
and for making it useable for more than 1 player, I will have to tweak:

PHP Code:
new afk[32];
if( ........ && 
afk[id] == 0  && .....){
  
//make afk
  //Reset variable
  
afk[id] = ;

Will this work for afk thingy ?
Yes. And is_user_alive has only two values 0 or 1. So if it is not == 1 then it is obviously 0. No need of else if( Checking if it is == 0 ). Also if you did any editing in your code, edit your first post so if there are any more corrections we can find out.
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here

Last edited by Shooting King; 07-24-2013 at 08:27.
Shooting King is offline
devWaleed
Member
Join Date: Apr 2013
Location: Karachi, Pakistan
Old 07-24-2013 , 09:54   Re: Please review my plugin, Any room for improvements?
Reply With Quote #12

@Shooting King: Ok, I tested my array code and it works. Thanks for telling me to do that.
@Yamikaitou: But if(true) ,What is true? While: if(is_user_alive(id) == true) , makes more sense?

Just clearing my doubt, don't mind please.

Last edited by devWaleed; 07-24-2013 at 09:55.
devWaleed is offline
Send a message via Skype™ to devWaleed
devWaleed
Member
Join Date: Apr 2013
Location: Karachi, Pakistan
Old 07-24-2013 , 10:02   Re: Please review my plugin, Any room for improvements?
Reply With Quote #13

But I have an issue with my code. If you join the server and goto spec' mode instead of joining any team. Then if you use /team to join any team. The crosshair on screen won't show. You'll have to rejoin the server and select team to play. How can I reset HUD? Or Redraw the crosshair, is it possible?
devWaleed is offline
Send a message via Skype™ to devWaleed
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-24-2013 , 10:07   Re: Please review my plugin, Any room for improvements?
Reply With Quote #14

Quote:
Originally Posted by devWaleed View Post
@Yamikaitou: But if(true) ,What is true? While: if(is_user_alive(id) == true) , makes more sense?
It was an example of an evaluated condition. is_user_alive(id) will evaluate to either 1 or 0 (since that is the only thing it can return), which Pawn will interrupt as True or False. So, doing is_user_alive(id)==true is redundant. You should only be checking the return value when you actually care what it is. An example when checking the return value is required is when using contain(i) since it will return -1 if it cannot find the string, and -1 is considered True by Pawn.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 07-24-2013 , 10:31   Re: Please review my plugin, Any room for improvements?
Reply With Quote #15

Quote:
Originally Posted by devWaleed View Post
But I have an issue with my code. If you join the server and goto spec' mode instead of joining any team. Then if you use /team to join any team. The crosshair on screen won't show. You'll have to rejoin the server and select team to play. How can I reset HUD? Or Redraw the crosshair, is it possible?
Quote:
Originally Posted by Shooting King View Post
Also if you did any editing in your code, edit your first post so if there are any more corrections we can find out.
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
devWaleed
Member
Join Date: Apr 2013
Location: Karachi, Pakistan
Old 07-24-2013 , 12:03   Re: Please review my plugin, Any room for improvements?
Reply With Quote #16

I already did!
devWaleed is offline
Send a message via Skype™ to devWaleed
MPD
Member
Join Date: May 2013
Location: Lithuania
Old 07-25-2013 , 05:16   Re: Please review my plugin, Any room for improvements?
Reply With Quote #17

Quote:
Originally Posted by devWaleed View Post
@Yamikaitou: But if(true) ,What is true? While: if(is_user_alive(id) == true) , makes more sense?

Just clearing my doubt, don't mind please.
Just read this If Statements
MPD is offline
Send a message via Skype™ to MPD
devWaleed
Member
Join Date: Apr 2013
Location: Karachi, Pakistan
Old 08-12-2013 , 17:03   Re: Please review my plugin, Any room for improvements?
Reply With Quote #18

ok, I am clear with that doubt.

Tell me one thing, If afk[33]; Are all arrays zeroed initially?
and
Code:
public client_disconnect(id){
	afk[id] = 0;
}
It should make array 0 in client drop, but will it also work if his game has crashed or pc power failure?

EDIT: Updated whole plugin code. Any suggestions now?

Last edited by devWaleed; 08-12-2013 at 18:02.
devWaleed is offline
Send a message via Skype™ to devWaleed
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-12-2013 , 19:11   Re: Please review my plugin, Any room for improvements?
Reply With Quote #19

Quote:
Originally Posted by devWaleed View Post
ok, I am clear with that doubt.

Tell me one thing, If afk[33]; Are all arrays zeroed initially?
and
Code:
public client_disconnect(id){
	afk[id] = 0;
}
It should make array 0 in client drop, but will it also work if his game has crashed or pc power failure?

EDIT: Updated whole plugin code. Any suggestions now?
Just do it on client_connect() and you don't need to worry about it.
__________________
fysiks is offline
devWaleed
Member
Join Date: Apr 2013
Location: Karachi, Pakistan
Old 08-13-2013 , 07:21   Re: Please review my plugin, Any room for improvements?
Reply With Quote #20

Ok, changed that thing.

If I want to check for user's flag normally ("z"). How will I compare it? For admin it can be ADMIN_KICK. I'll be making another headshot counter thing between 2 players from different team, 1 CT and T. So, should I only transfer players if they have z flag? or not transfer a player if they have special flag for example, "u" ? Because if 1 of the selected player is transferred to his enemy's team then headshot contest plugin will be disturbed.
devWaleed is offline
Send a message via Skype™ to devWaleed
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 06:28.


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