02-14-2011, 12:26 PM
(02-14-2011, 07:35 AM)Matthias link Wrote: How are the variables passed on to that function constant in any way?
In what circumstances would these parameters not be constant darling? Please elaborate here.
In no instance should the function modify any of these variables.
Using initialisers allows for more efficient compiling.
(02-14-2011, 07:35 AM)Matthias link Wrote: It should look like this:
Code:stock registerPlayerAccount (playerAccountName[], playerPassword[])
{
SendPlayerMessage (playerid, MSG_STYLE_BOX, "You have registered an account.");
return;
}
Whilst it may be better coding practice to prefix functions with lowercase letters in other languages, SA-MP's syntax is different to this and would complicate matters if we changed it now.
Quote:Code:new bool:isPlayerRegistered;
new playerState;
new playerMessage[128];
Should be something like that. Although I still wouldn't know what "playerMessage" would contain.
Again not only is it better coding practice to prefix variable names with a single lowercase letter to indicate the variable type but it makes future reference much easier. It is pretty obvious that the sPlayerMessage variable is a string given the s prefix.