SA-MP Forums Archive
Text Parameter? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Text Parameter? (/showthread.php?tid=139909)



Text Parameter? - lRaged - 06.04.2010

How would I create a command with a text parameter?

e.g. /goto lossantos and /goto sanfierro

I don't want you to create that command for me. Could some just create a blank script for me which has a text parameter?


Re: Text Parameter? - aircombat - 06.04.2010

use dcmd+sscanf , its the best for parameters


Re: Text Parameter? - Nero_3D - 06.04.2010

Without any other function
pawn Код:
if(strcmp("command", cmdtext[1], true, 7) && (cmdtext[8] == 32 || cmdtext[8] == EOS))
{
    if(cmdtext[8] != 32 || cmdtext[9] == EOS)
        return SendClientMessage(playerid, 0xFFFFFFAA, "Right Usage: /command [text]");
    //the text would be "cmdtext[9]"
    return 1;
}
Dcmd
pawn Код:
//OnPlayerCommandText
dcmd(command, 7, cmdtext); //7 is the length of "command"
pawn Код:
dcmd_command(playerid, parameter[])
{
    if(parameter[0] == EOS)
        return SendClientMessage(playerid, 0xFFFFFFAA, "Right Usage: /command [text]");
    //the text would be "parameter"
}
Zcmd
pawn Код:
cmd_command(playerid, parameter[])
{
    if(parameter[0] == EOS)
        return SendClientMessage(playerid, 0xFFFFFFAA, "Right Usage: /command [text]");
    //the text would be "parameter"
}