Separate the AMX
#16

Quote:
Originally Posted by MaVe;
Quote:
Originally Posted by SMX
To those people talking about the wrappers being fine; have you ever looked at their source? They do a lot of stuff behind your back that wouldn't be necesary if my suggestion gets realised.
What's that stuff exactly?
For example when you call SendClientMessage from your plugin:
First you need to locate it's address which only has to be done once so thats not much of a problem.
Next is allocating an array of cells in the AMX for the text string you want to send.
Then you need to convert and copy your string from a char array to that array of cells.
All that before you can call it.

Now if we would separate the AMX the prototype for SendClientMessage would probably look like this:
Код:
int SendClientMessage(int playerid, int colour, char* text);
int SendClientMessage(int playerid, int colour, wchar_t* text);   //Support non latin languages?
With that you could just pass a pointer to your string, no copying or whatever required.

Calling functions that pass arguments by reference also require you to allocate space in the AMX.
Think of GetPlayerPos used for a speedometer, how many times does that get called for each player per second? See how it's adding up now?
Reply


Messages In This Thread
Separate the AMX - by SMX - 28.12.2009, 21:44
Re: Separate the AMX - by cmg4life - 28.12.2009, 22:02
Re: Separate the AMX - by pliva_sb - 28.12.2009, 22:06
Re: Separate the AMX - by Zeex - 28.12.2009, 22:22
Re: Separate the AMX - by Google63 - 28.12.2009, 22:54
Re: Separate the AMX - by SMX - 28.12.2009, 23:11
Re: Separate the AMX - by Striker_Moe - 31.12.2009, 19:49
Re: Separate the AMX - by Calon - 04.01.2010, 07:11
Re: Separate the AMX - by BP13 - 04.01.2010, 07:20
Re: Separate the AMX - by MPKaboose - 04.01.2010, 15:13
Re: Separate the AMX - by SMX - 04.01.2010, 15:53
Re: Separate the AMX - by JernejL - 04.01.2010, 16:01
Re: Separate the AMX - by Burridge - 04.01.2010, 16:16
Re: Separate the AMX - by SMX - 04.01.2010, 21:29
Re: Separate the AMX - by Streetplaya - 05.01.2010, 22:15
Re: Separate the AMX - by SMX - 06.01.2010, 02:54
Re: Separate the AMX - by Streetplaya - 06.01.2010, 07:37
Re: Separate the AMX - by Streetplaya - 06.01.2010, 08:46
Re: Separate the AMX - by Streetplaya - 06.01.2010, 09:35
Re: Separate the AMX - by SMX - 06.01.2010, 13:41
Re: Separate the AMX - by Streetplaya - 06.01.2010, 17:33
Re: Separate the AMX - by SMX - 06.01.2010, 21:54
Re: Separate the AMX - by SMX - 07.01.2010, 02:21
Re: Separate the AMX - by SMX - 07.01.2010, 13:41
Re: Separate the AMX - by Streetplaya - 07.01.2010, 13:46
Re: Separate the AMX - by Google63 - 07.01.2010, 13:52
Re: Separate the AMX - by SMX - 07.01.2010, 14:29
Re: Separate the AMX - by Streetplaya - 07.01.2010, 14:35
Re: Separate the AMX - by SMX - 07.01.2010, 14:43
Re: Separate the AMX - by Streetplaya - 07.01.2010, 14:52
Re: Separate the AMX - by SMX - 07.01.2010, 16:07
Re: Separate the AMX - by SMX - 07.01.2010, 16:43
Re: Separate the AMX - by iLinx - 11.01.2010, 13:53
Re: Separate the AMX - by SMX - 11.01.2010, 20:01
Re: Separate the AMX - by iLinx - 12.01.2010, 20:29
Re: Separate the AMX - by SMX - 12.01.2010, 22:32
Re: Separate the AMX - by Littlejth - 22.01.2010, 03:48
Re: Separate the AMX - by Streetplaya - 22.01.2010, 13:02

Forum Jump:


Users browsing this thread: 1 Guest(s)