27.07.2012, 17:01
R3 alz o intrebare am si eu cum fac unele comenzi pe nume de ex: /setadmin sa fie pe nume daca am numele adyi sa pot folosi aceea comanda . Am vazut pe un server si nuj cum s afca pls mult Ms
#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