Comenzi pe nume - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Comenzi pe nume (
/showthread.php?tid=363433)
Comenzi pe nume -
adyi - 27.07.2012
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
Re: Comenzi pe nume -
Hazliu - 21.07.2015
Ori dai edit si pui in engleza ca sa te ajute, ori copy-paste aici
http://forum.sa-mp.com/forumdisplay.php?f=40
P.S: Si eu caut.
Re: Comenzi pe nume -
Mariciuc223 - 21.07.2015
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
Код:
#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 :
Код:
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