Best effiecent scripting
#3

Quote:
Originally Posted by Jack_Leslie
View Post
How ever it's the actual style/method of coding I'm worried about that's going to make it inefficient. One thing is, for dialogs, I use dialog defines so that I can keep track of what dialog numbers I'm at.
Example:
pawn Code:
#define DIALOG_LOGIN 1
That's fine.
Quote:
Originally Posted by Jack_Leslie
View Post
Then, for player related variables (not sure of the technical name), I use a define for them.
Example:
pawn Code:
#define MAX_PLAYERS MP

new gIsPlayerLoggedIn[MP];
pawn Code:
#define  MP  MAX_PLAYERS
Is the correct way, you had it backwards.

Quote:
Originally Posted by Jack_Leslie
View Post
I then use this style of coding when I create a command:
pawn Code:
CMD:connected(playerid, params[])
{
    if(IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "You are connected.");
    else return SendClientMessage(playerid, -1, "For some reason, you are not connected.");
}
Instead of:
pawn Code:
CMD:connected(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, -1, "You are connected.");
        return 1;
    }
    else
    {
        SendClientMessage(playerid, -1, "For some reason, you are not connected.");
    }
    return 1;
}
There is literally no difference in efficiency between the two, it just makes you read it differently. Personal choice really.
Reply


Messages In This Thread
Best effiecent scripting - by Jack_Leslie - 31.07.2012, 03:27
Re: Best effiecent scripting - by dannyk0ed - 31.07.2012, 03:33
Re: Best effiecent scripting - by ReneG - 31.07.2012, 03:53
Re: Best effiecent scripting - by Jack_Leslie - 31.07.2012, 03:56
Re: Best effiecent scripting - by coole210 - 31.07.2012, 03:56
Re: Best effiecent scripting - by Jack_Leslie - 31.07.2012, 04:01
Re: Best effiecent scripting - by coole210 - 31.07.2012, 04:22
Re: Best effiecent scripting - by JoBullet - 31.07.2012, 05:00
Re: Best effiecent scripting - by CaHbKo - 31.07.2012, 08:40
Re: Best effiecent scripting - by CaHbKo - 31.07.2012, 09:16
Re: Best effiecent scripting - by Sinner - 31.07.2012, 09:31
Re: Best effiecent scripting - by Sniper Kitty - 31.07.2012, 09:32
Re: Best effiecent scripting - by Vince - 31.07.2012, 09:49
Re: Best effiecent scripting - by Jack_Leslie - 31.07.2012, 11:07
Re: Best effiecent scripting - by Slice - 31.07.2012, 11:10
Re: Best effiecent scripting - by Jack_Leslie - 31.07.2012, 11:12
Re: Best effiecent scripting - by IstuntmanI - 31.07.2012, 11:13
Re: Best effiecent scripting - by Slice - 31.07.2012, 11:26
Re: Best effiecent scripting - by Jack_Leslie - 31.07.2012, 11:46
Re: Best effiecent scripting - by Vince - 31.07.2012, 11:52
Re: Best effiecent scripting - by Universal - 31.07.2012, 12:17
Re: Best effiecent scripting - by Jack_Leslie - 31.07.2012, 12:20
Re: Best effiecent scripting - by Slice - 31.07.2012, 12:21
Re: Best effiecent scripting - by SuperViper - 31.07.2012, 16:26
Re: Best effiecent scripting - by The__ - 31.07.2012, 18:08
Re: Best effiecent scripting - by SuperViper - 31.07.2012, 19:05
Re: Best effiecent scripting - by Finn - 31.07.2012, 19:15
Re: Best effiecent scripting - by The__ - 31.07.2012, 19:24
Re: Best effiecent scripting - by Universal - 31.07.2012, 19:36
Re: Best effiecent scripting - by [KHK]Khalid - 02.08.2012, 03:12
Re: Best effiecent scripting - by Y_Less - 02.08.2012, 07:07
Re: Best effiecent scripting - by Ash. - 02.08.2012, 11:29
Re: Best effiecent scripting - by WackoX - 02.08.2012, 12:25
Re: Best effiecent scripting - by Y_Less - 02.08.2012, 14:13
Re: Best effiecent scripting - by [KHK]Khalid - 02.08.2012, 17:00
Re: Best effiecent scripting - by Y_Less - 02.08.2012, 18:44
Re: Best effiecent scripting - by [KHK]Khalid - 02.08.2012, 19:10

Forum Jump:


Users browsing this thread: 4 Guest(s)