Raised This Month: $ Target: $400
 0% 

AMXX Errors


Post New Thread Reply   
 
Thread Tools Display Modes
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 06-17-2012 , 00:24   Re: AMXX Errors
Reply With Quote #11

Quote:
Originally Posted by Waleed View Post
Why everybody use:
Code:
fw_playerspawn //fw_ before this function
I have been using only
Code:
PlayerSpawn
PlayerAlive  // No fw_ before calling functions
Will it cause any error or is it good?
It is used to show what type of function it is.

'fw' is generally used for forward.

It isn't required, but I recommend to use it so the readability is easier for other users.
__________________
Hi.
Kreation is offline
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-17-2012 , 02:02   Re: AMXX Errors
Reply With Quote #12

Then what the hell is Fw / Forward ?????
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]
Waleed is offline
Send a message via Skype™ to Waleed
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-17-2012 , 02:19   Re: AMXX Errors
Reply With Quote #13

Quote:
Originally Posted by Waleed View Post
Then what the hell is Fw / Forward ?????
The use of fw_ in the function names is just a naming convention people use, it bears no difference how you name functions.

Example, this is valid though will confuse lots of newbies

Code:
RegisterHam( Ham_Spawn , "player" , "PlayerDeath" , true );

Sticking to a common naming convention allows other people who are reviewing your code to be able to easily determine what each function and variable do or contain. There is no requirement to using a naming convention though
__________________
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
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-17-2012 , 02:50   Re: AMXX Errors
Reply With Quote #14

Won't it be much easier to work with:
PHP Code:
RegisterHamHam_Spawn "player" "Ham_PlayerDeath" true ); 
Ham_ defines a Ham constant rather then using fw_
Thanks anyway!

I hope you can answer my thread:
http://forums.alliedmods.net/showthread.php?t=187722 - Thanks for this too
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]

Last edited by Waleed; 06-17-2012 at 02:52. Reason: Added a Link
Waleed is offline
Send a message via Skype™ to Waleed
DjOptimuS
Senior Member
Join Date: Jan 2009
Old 06-17-2012 , 04:49   Re: AMXX Errors
Reply With Quote #15

this is really stupid

if (id < 0)
id = 0;
if (id > 31)
id = 31;


How about the 32 player ?
DjOptimuS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2012 , 12:22   Re: AMXX Errors
Reply With Quote #16

Quote:
Originally Posted by Waleed View Post
Won't it be much easier to work with:
PHP Code:
RegisterHamHam_Spawn "player" "Ham_PlayerDeath" true ); 
Ham_ defines a Ham constant rather then using fw_
Thanks anyway!
Like he said, it doesn't matter what you name it, technically. I could even do this if I wanted to:

PHP Code:
RegisterHam(Ham_Spawn"player""lkasjfoiyerwopepirjsdf"1); 
It is entirely subjective. However, If you do it like I did above, it will just be harder to interpret the code.


Quote:
Originally Posted by DjOptimuS View Post
this is really stupid

if (id < 0)
id = 0;
if (id > 31)
id = 31;


How about the 32 player ?
I don't know C++ well but I'm pretty sure that "id" is not referring to a player entity since "index" is the first argument of the function (aka the player entity that is often written as "id" in plugins). You are forgetting that "id" is not a special variable, it can be anything that you want it to be.
__________________

Last edited by fysiks; 06-17-2012 at 12:23.
fysiks is offline
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 04:23.


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