Issue with SScanf and string
#10

Quote:
Originally Posted by justjamie
Посмотреть сообщение
(rules state you have to test it before you can post it btw, nonetheless)
Seriously? If you provided enough details at first place (that's a rule too, by the way) I could have deleted the necessary lines of that horrible written code so I can test it myself.

Quote:
Originally Posted by justjamie
Посмотреть сообщение
you cant use sscanf multiple times anyways.
Here is A LOT of documentation about sscanf, go read some since it can be very handy later on.
https://sampforum.blast.hk/showthread.php?tid=570927


This works perfectly fine. TESTED.
Код:
/* ============================================================================ */ 
CMD:barrier(playerid, params[]) 
{ 
    new tmp[15], tmp2[64], barriertype; 
    if(sscanf(params, "s[15]DS[64]", tmp, barriertype, tmp2 ) ) return SendClientMessage(playerid, -1, "/barrier [ Deploy / Destroy / List]"); 
	if(!strcmp(tmp, "deploy", true)) 
	{  
		if(sscanf(params, "s[15]ds[64]", tmp, barriertype, tmp2)) return SendClientMessage(playerid, -1, "/barrier deploy [1/2/3/4] [Note]");  
		printf("%s %d %s", tmp, barriertype, tmp2);
	} 
	else if(!strcmp(tmp, "destroy", true)) 
	{ 
		if(sscanf(params, "s[15]d", tmp, barriertype)) return SendClientMessage(playerid, -1, "/barrier destroy [id]"); 
		printf("%s %d %s", tmp, barriertype, tmp2);
	} 
    else if(!strcmp(tmp, "list", true)) 
    { 
        print("list");
    } 
    else 
    { 
        SendClientMessage(playerid,-1,"/barrier [ Deploy / Destroy / List]"); 
    } 
    return 1; 
} 
/* ============================================================================= */
Reply


Messages In This Thread
Issue with SScanf and string - by justjamie - 26.08.2016, 14:23
Re: Issue with SScanf and string - by Marricio - 26.08.2016, 14:36
Re: Issue with SScanf and string - by DarkSkull - 26.08.2016, 14:37
Re: Issue with SScanf and string - by justjamie - 26.08.2016, 15:03
Re: Issue with SScanf and string - by Shinja - 26.08.2016, 15:06
Re: Issue with SScanf and string - by Marricio - 26.08.2016, 15:13
Re: Issue with SScanf and string - by justjamie - 26.08.2016, 15:16
Re: Issue with SScanf and string - by WhiteGhost - 26.08.2016, 15:18
Re: Issue with SScanf and string - by Stinged - 26.08.2016, 15:34
Re: Issue with SScanf and string - by Marricio - 26.08.2016, 19:13

Forum Jump:


Users browsing this thread: 1 Guest(s)