SA-MP Forums Archive
What's get string using GetArg ? - 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: What's get string using GetArg ? (/showthread.php?tid=339832)



What's get string using GetArg ? - zSuYaNw - 05.05.2012

Exemple:

pawn Код:
AddBadWords(text,  "Char", "Red");


// Function ( not completed )
stock AddBadWorld(string[], ...)
{
    for(new percorrer, argumentos = numargs(); percorrer != argumentos; ++percorrer)
    {
        {
            printf("%s", getarg(percorrer, 0));
        }
    }
   
    #pragma unused string
    return 1;
}
i Need show's:

Код:
"Char"
"Red"
Thks.


Re: What's get string using GetArg ? - Crazymax - 05.05.2012

Try this... works for me and ignore the warning ( i don't know how to fix it)
pawn Код:
stock AddBadWords(string[], ...)
{
    new temp[2];
    for(new percorrer, argumentos = numargs(); percorrer != argumentos; ++percorrer)
    {
        new str[128],x=0;
        while(1){
            new chari=getarg(percorrer,x);
            format(temp,sizeof(temp),"%s",chari);
            strcat(str,temp);
            x++;
            if(chari==0) break;
        }
        printf("%s", str);
    }

    #pragma unused string
    return 1;
}



Re: What's get string using GetArg ? - zSuYaNw - 05.05.2012

Quote:
Originally Posted by Crazymax
Посмотреть сообщение
Try this... works for me and ignore the warning ( i don't know how to fix it)
pawn Код:
stock AddBadWords(string[], ...)
{
    new temp[2];
    for(new percorrer, argumentos = numargs(); percorrer != argumentos; ++percorrer)
    {
        new str[128],x=0;
        while(1){
            new chari=getarg(percorrer,x);
            format(temp,sizeof(temp),"%s",chari);
            strcat(str,temp);
            x++;
            if(chari==0) break;
        }
        printf("%s", str);
    }

    #pragma unused string
    return 1;
}
I fixed this width post of RyDer's.

Anything, http://pastebin.com/LQQEL3SS.