SA-MP Forums Archive
2 commands in 1 +REP! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 2 commands in 1 +REP! (/showthread.php?tid=331811)



2 commands in 1 +REP! - TheMightyEddy - 06.04.2012

Код:
CMD:loc(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /loc [id]");
 
    new
        pID = strval(params),
        zName[64] = "Unknown Location",
        iStr[128];

    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Invalid ID or the User is Not Online.");

    GetPlayerInZone(pID, zName, 64);

    format(iStr, sizeof(iStr), "Location of %s(%d): %s", pName(pID), pID, zName);
    SendClientMessage(playerid, G, iStr);
    return 1;
}
As you see my above code shows the location of a player. But I can only type /loc [id] to see the location of a player. Is there a way to also use /info or /location or /i to show the location without typing the whole code multiple times with different commands? +REP!


Re: 2 commands in 1 +REP! - Cjgogo - 06.04.2012

pawn Код:
COMMAND:info(playerid,params[])
{
  return cmd_loc(playerid,params);
}
pawn Код:
COMMAND:i(playerid,params[])
{
   return cmd_loc(playerid,params);
}



Re: 2 commands in 1 +REP! - TheMightyEddy - 06.04.2012

Works! Thanks! +rep


Re: 2 commands in 1 +REP! - Rob_Maate - 06.04.2012

As the above posted, just place a whole heap of variants directly above your command.

pawn Код:
CMD:i(playerid, params[]) return cmd_information(playerid, params);
CMD:in(playerid, params[]) return cmd_information(playerid, params);
CMD:info(playerid, params[]) return cmd_information(playerid, params);
CMD:loc(playerid, params[]) return cmd_information(playerid, params);
CMD:location(playerid, params[]) return cmd_information(playerid, params);
CMD:information(playerid, params[])
{
    //Funky Town
    return 1;
}



Re: 2 commands in 1 +REP! - TheMightyEddy - 06.04.2012

Quote:
Originally Posted by Rob_Maate
Посмотреть сообщение
As the above posted, just place a whole heap of variants directly above your command.

pawn Код:
CMD:i(playerid, params[]) return cmd_information(playerid, params);
CMD:in(playerid, params[]) return cmd_information(playerid, params);
CMD:info(playerid, params[]) return cmd_information(playerid, params);
CMD:loc(playerid, params[]) return cmd_information(playerid, params);
CMD:location(playerid, params[]) return cmd_information(playerid, params);
CMD:information(playerid, params[])
{
    //Funky Town
    return 1;
}
Even better! +REP for you too!