A little params problem
#8

Explanation: (Btw, BIOS, you can turn off your caps.)

pawn Код:
CMD:gotopos(playerid, params[]) //This is how you DECLARE the start of a command in ZCMD.
{
    new Float:x, Float:y, Float:z; //Declaring floats x, y and z here.
    if(sscanf(params, "fff", x, y, z)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /gotopos x y z");
/*Okay. Now, sscanf detects 'parts' of text you input.
Like if you did, sscanf("hello 27","si",string,int) it would return *hello*
*27* It kind of splits it. So since you have not input any thing, if you sscanf it, there's nothing to split.
Hence, if(sscanf(params,"fff",x,y,z)) return error message. Here "fff" means "float float float" --> x, y, z. Meaning first float entered is given value of x and so on. */

    SetPlayerPos(playerid, x, y, z); //Simple.
    return 1;
}
This is how I understood sscanf, I don't know if the original explanation differs.
Reply


Messages In This Thread
A little params problem - by Frede - 13.01.2013, 07:25
AW: A little params problem - by BiosMarcel - 13.01.2013, 07:34
Re: A little params problem - by Threshold - 13.01.2013, 07:34
AW: A little params problem - by BiosMarcel - 13.01.2013, 07:37
Re: A little params problem - by Frede - 13.01.2013, 07:38
AW: A little params problem - by BiosMarcel - 13.01.2013, 07:41
Re: AW: A little params problem - by Threshold - 13.01.2013, 07:41
Re: A little params problem - by RajatPawar - 13.01.2013, 07:42
Re: A little params problem - by Frede - 13.01.2013, 07:42
AW: A little params problem - by BiosMarcel - 13.01.2013, 07:44

Forum Jump:


Users browsing this thread: 1 Guest(s)