Useful includes

From SA-MP Wiki

Jump to: navigation, search

Contents

Introduction

You'll find various useful, and widely used, includes. if you need to find a include, you can use <Ctrl>+<F>. if it isnt on this page, use google and add it to the discussion of this page.

Command Processors

ZCMD

Info

Zeex's command processor, most used command processor nowadays. It uses CallLocalFunction to call the commands.

Syntax

COMMAND:mycommand(playerid, params[]) // or CMD:mycommand(playerid, params[]) 
{
  // Do something
  return 1; 
}

Download

http://forum.sa-mp.com/showthread.php?t=91354

Ycmd

Info

Ycmd is a part of the script includes package YSI made by Y_Less. it has dynamic command renaming, language support, and a help parameter. it also has a nice list of built in functions to fiddle around with the commands, like getting all command names.

Syntax

YCMD:commands(playerid, params[], help)
{
    if (help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Lists all the commands a player can use.");
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, Command_GetNext(i, playerid));
    }
    return 1;
}

Download

http://forum.sa-mp.com/showthread.php?t=169029

Dcmd

Info

This command processor doesn't need a seperate parameter splitter like Sscanf. this processor has that feature built in.

Syntax

public OnPlayerCommandText(playerid, const cmdtext[])
dcmd_command(playerid,params[]) 
{
   //do stuff
   return true;
}
{
  dcmd(command,2,cmdtext);
  return 0;
}

Download

The original topic got lost, but it is only a define.

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Personal tools
Navigation
Toolbox