26.08.2016, 19:13
Quote:
(rules state you have to test it before you can post it btw, nonetheless)
|
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; } /* ============================================================================= */