SA-MP Forums Archive
How to make command with two string arguments? - 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: How to make command with two string arguments? (/showthread.php?tid=456738)



How to make command with two string arguments? - Micius - 07.08.2013

How to make command with two string arguments?
Example:

--------STRING1 --- STRING2
/test1 simple_test Long long test......


Re: How to make command with two string arguments? - DemCaribous - 07.08.2013

i believe this is what you are referring to?
https://sampwiki.blast.hk/wiki/Strcat


Re: How to make command with two string arguments? - Skribblez - 07.08.2013

Check the link below, I suggest you use it.
Link: https://sampforum.blast.hk/showthread.php?tid=120356

Here's an example:
pawn Код:
command(words, playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new string[128], word[2][32];
        if(sscanf(params, "s[32]s[32]", word[0], word[1])) return SendClientMessage(playerid, -1, "Usage: /words <word1> <word2>");
        if(!strlen(word[0]) || !strlen(word[1])) return SendClientMessage(playerid, -1, "No words typed!");
       
        format(string, sizeof(string), "Your words are: %s and %s.", word[0], word[1]);
        SendClientMessage(playerid, -1, string);
    }
    return 1;
}
Is that what you're trying to do?


Re: How to make command with two string arguments? - Youarex - 07.08.2013

Much more simple:

pawn Код:
CMD:test(playerid, params[])
{
    new
        str01[32],
        str02[32];

    if(!sscanf(params, "s[32]s[32]", str01, str02))
    {
        //Your code
    }
    else
    {
        SendClientMessage(playerid, -1, "Usage: /test <string1> <string2>");
    }
    return 1;
}
Assuming you're using ZCMD or y_commands.


Re: How to make command with two string arguments? - Micius - 07.08.2013

Thanks guys, really helped.