21.07.2015, 12:50
RO
folosesti ZCMD si sscanf includes ...
EN
You need to use ZCMD with sscanf includes ..
EDIT: A little exemple how to use that includes , a /id command
sscanf :
folosesti ZCMD si sscanf includes ...
EN
You need to use ZCMD with sscanf includes ..
EDIT: A little exemple how to use that includes , a /id command
Код:
#define FILTER_SCRIPT #include <a_samp> #include <ZCMD> #include <sscanf> CMD:id(playerid, params[]) { new rName[MAX_PLAYER_NAME], String[128], Reciver; if(sscanf(params[], "u", Reciver) { SendClientMessage(playerid, -1, "USAGE: /id [PlayerID/PartOfName]"); return 1; } GetPlayerName(Reciver, rName, sizeof(rName)); format(String, sizeof(String), "Player %s have ID %i !", pName, Reciver); SendClientMessage(playerid, -1, String); return 1; }
Код:
sscanf(const data[], const [format], {Float,...}); // I'm not good at explanations but i can say const data it's on our case params[] - what you type before /id .. think you understand // const format[] = Specifier -- See down there // The last parameter it's in our case Reciver , if you use the specifier "u" that mean ID of player .. Hope you understand what i try to tell you there
Код:
Specifier(s) Name Example values i, d Integer 1, 42, -10 c Character a, o, * l Logical true, false b Binary 01001, 0b1100 h, x Hex 1A, 0x23 o Octal 045 12 n Number 42, 0b010, 0xAC, 045 f Float 0.7, -99.5 g IEEE Float 0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E u User name/id (bots and players) ******, 0 q Bot name/id ShopBot, 27 r Player name/id ******, 42