SA-MP Forums Archive
Problem command - 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: Problem command (/showthread.php?tid=561560)



Problem command - Johnny_Ionut - 03.02.2015

Hello
Anyone can help me?
This command doesn't work. Why?
pawn Код:
CMD:gethelper(playerid, params[])
    {
        new tmp[256];
        new string[256];
        new idx;
        tmp = strtok(params, idx);
        if(sscanf(params, "ud",params[0],params[1])) return SendClientMessage(playerid, COLOR_WHITE, "Type: /gothelper [SLOT] [NAME]");
        if (Info[playerid][pAdmin] >= 4)
        {
            new stat;
            stat = params[0];
            switch (stat)
            {
                case 1:
                {
                    new file = ini_openFile("/leaders.ini");
                    INI_WriteString(file,"LSPD",params[1]);
                    format(string, sizeof(string), "LSPD  -  %s", string);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    ini_closeFile(file);//
                }
                default:
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Invalid ID");
                }
            }
        }
        return 1;
    }



Re: Problem command - Johnny_Ionut - 03.02.2015

I wish you access command (/ gethelper [SLOT] [HELPER]) to edit HELPER1 name which I will add it.


Re: Problem command - SnG.Scot_MisCuDI - 03.02.2015

Use sscanf: https://sampforum.blast.hk/showthread.php?tid=120356

remove
pawn Код:
if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid, COLOR_WHITE, "Type: /gothelper [SLOT] [NAME]");
use

pawn Код:
if(sscanf(params, "is[32]", slot, helper)) return SendClientMessage(playerid, COLOR_WHITE, "Type: /gothelper [SLOT] [NAME]");



Re: Problem command - Johnny_Ionut - 03.02.2015

Quote:
Originally Posted by SnG.Scot_MisCuDI
Посмотреть сообщение
Use sscanf: https://sampforum.blast.hk/showthread.php?tid=120356

remove
pawn Код:
if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid, COLOR_WHITE, "Type: /gothelper [SLOT] [NAME]");
use

pawn Код:
if(sscanf(params, "is[32]", slot, helper)) return SendClientMessage(playerid, COLOR_WHITE, "Type: /gothelper [SLOT] [NAME]");
ok,but you could do me this command? are started scripting and still do not understand some things.