AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   Ideas to make your coding experience easier (https://forums.alliedmods.net/showthread.php?t=59378)

^BuGs^ 08-12-2007 23:06

Ideas to make your coding experience easier
 
I been witnessing lots of people doing the same thing so I compiling a bunch of tips.
  1. Before starting a project:
    1. Decide what you are really going to do. (Game play, administration, fun, etc.)
    2. Decide how you are going to do it.
    3. Make sure you can handle that project.
  2. Be sure that you are using latest versions. (MM:S, SM and API's you use.)
  3. Always make a "To Do" list and a change log to keep your project organized.
  4. Check to see if something your about to code in your script is already being done by another plugin with their API. (Don't reinvent the wheel.)
    1. Reason: Less Memory Usage
    2. Example: Repeated messages that go to all client to tell something (i.e. Type !yourtriggerhere to run me)
    3. Possible Solution: Use the Ads API. Allows better control flow of messages. (Shameless plug)
    4. Con: Online compiler will not work.
  5. Your plugin provide functionally that everyone could use... create an API with the needed natives. Bouns... make it so it's optional so you don't force the person using your plugin, also have to use the secondary plugin just so they can disable it once it's running.
  6. Highly recommend using http://sm.nican132.com/ for fast looking up of function definitions.
  7. Do not hardcode values. Use Cvars or a configuration file.
  8. Tell users your project's compatibilities/dependencies. (OS, mod, extensions, plugins, APIs)
  9. Don't wait for a request to put screenshots. You can use Picasa Web to organize your screenshots easily.
  10. Do not create your own "MAX CLIENTS" define. Use MAXPLAYERS. If this is going to be an array, do not forget the "+ 1". Client Index start 1 -- not 0.(Hint for people who want their plugins approved.)
  11. Post your suggestion!

Shaman 08-13-2007 07:26

Re: Ideas to make your coding experience easier
 
Don't hardcode ;)

^BuGs^ 08-13-2007 07:41

Re: Ideas to make your coding experience easier
 
Quote:

Originally Posted by Peoples Army (Post 517420)
:wink:that was a shamless plug lol .

Yes, but true. If half the scripts used the Ads API, people would be able to control if they wanted advertisements. For me having tons of messages show in chat is mading. Having a script that does ads + my ads plugins creates 3 to 5 lines in chat which are removed right away from other content. i.e. Someone joining or throwing a grenade.

Peoples Army 08-13-2007 07:53

Re: Ideas to make your coding experience easier
 
helpfull tip 4:

DO NOT use pencil and paper as a SDK. :down:

Shaman 08-13-2007 09:25

Re: Ideas to make your coding experience easier
 
1- Before starting a project:
Decide what you are really going to do. (Game play, administration, fun, etc.)
Decide how you are going to do it.
Make sure you can handle that project.

2- Be sure that you are using latest versions. (MM: S, SM and API's you use.)

3- Always make a "To Do" list and a change log to keep your project organized.

4- Tell users your project's compatibilities/dependencies. (OS, mod, extensions, plugins, APIs)

5- Don't wait for a request to put screenshots. You can use Picasa Web to organize your screenshots easily.

dubbeh 08-13-2007 09:49

Re: Ideas to make your coding experience easier
 
Good thing is to make use of the stack that might be a very similiar function but with a very small change

eg.
PHP Code:


CreatePlayerListMenu 
(clientHandle:hMenu, const String:szMenuTitle[], MenuHandler:Handler)
{
    
decl String:szClientIndex[8] = ""String:szClientName[64] = "";
    static 
iIndex 0;

    
hMenu CreateMenu (Handler);
    
SetMenuTitle (hMenuszMenuTitle);
    
    
iIndex 1;
    while (
iIndex <= g_iMaxClients)
    {
        if (
IsClientConnected (iIndex) && IsClientInGame (iIndex))
        {
            
GetClientName (iIndexszClientNamesizeof (szClientName));
            
Format (szClientIndexsizeof (szClientIndex), "%d"iIndex);
            
AddMenuItem (hMenuszClientIndexszClientName);
        }

        
iIndex++;
    }

    
DisplayMenu (hMenuclientMENU_TIME_FOREVER);


Using this for diffrent menus like player kick/ban/mute - find it saves lots of coding time & clutter in overall code ;)

spelworm 08-14-2007 02:59

Re: Ideas to make your coding experience easier
 
i just cant figure out how all the commands work >< i can look at it for a long time and the only thing i know then is i need a asprine against the headache
is there some page that will explain how u write a command with a example i checked the wiki page but it just isnt very clear to me

btw why are all the posts deleted ?:P

dubbeh 08-14-2007 07:29

Re: Ideas to make your coding experience easier
 
Highly recommend using http://sm.nican132.com/ for fast looking up of function definitions

Love it if someone would be willing to make a searchable chm file for easy local lookup

Nican 08-14-2007 12:40

Re: Ideas to make your coding experience easier
 
Quote:

Originally Posted by dubbeh (Post 517885)
Highly recommend using http://sm.nican132.com/ for fast looking up of function definitions

Love it if someone would be willing to make a searchable chm file for easy local lookup

Do you know how to make .chm file? If you want I can upload the MySQL database for you, or you can teach me how to make one, since SM is being update constantly...

dubbeh 08-14-2007 13:33

Re: Ideas to make your coding experience easier
 
Found quite a few window based ones & the SDK can be download from the MSDN

I'll keep looking around & see if i can find a php script


All times are GMT -4. The time now is 03:01.

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