13.07.2014, 18:06
(
Последний раз редактировалось SHE790; 15.08.2014 в 10:40.
)
Hi all this is my first tutorial i hope i help who dont know how to make this cmd
What do we need?
We need sscanf and zcmd
sscanf: https://sampforum.blast.hk/showthread.php?tid=120356 by ******
zcmd: https://sampforum.blast.hk/showthread.php?tid=91354 by Zeex
Step 1
first of all u need to #include <a_samp> and <zcmd> and <sscanf>
so on top of your script add
Step 2
You need colors so we need to #define COLOR_RED
Step 3
We need enums too Dont Know whats enum? visit: https://sampforum.blast.hk/showthread.php?tid=318307
Step 4
Lets Start
Also we need GetName Stock Dont what what is stock? visit: https://sampwiki.blast.hk/wiki/Stocks
All the specifiers:
What do we need?
We need sscanf and zcmd
sscanf: https://sampforum.blast.hk/showthread.php?tid=120356 by ******
zcmd: https://sampforum.blast.hk/showthread.php?tid=91354 by Zeex
Step 1
first of all u need to #include <a_samp> and <zcmd> and <sscanf>
so on top of your script add
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
You need colors so we need to #define COLOR_RED
pawn Код:
#define COLOR_RED 0xFF0006FF
We need enums too Dont Know whats enum? visit: https://sampforum.blast.hk/showthread.php?tid=318307
pawn Код:
enum PlayerInfo
{
Adminlevel
}
new pInfo[MAX_PLAYERS][PlayerInfo];
Lets Start
pawn Код:
CMD:disarm(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid, COLOR_RED, "You're not authorized to use this command");//2 is the admin level that can use it and SendClientMessage(playerid, COLOR_RED, "You're not authorized to use this command"); this is the message when the player is not admin or lower than 2
new
string[128],targetid;
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid, -1, "USAGE: /disarm [playerid]");//"u" is the specifier that stands for playername/playerid and -1 is color white
format(string,sizeof(string),"Admin %s has disarmed %s",GetName(playerid),GetName(targetid));
SendClientMessageToAll(COLOR_RED,string);// %s is the player name
ResetPlayerWeapons(targetid);//this will reset all player weapons
return 1;
}
pawn Код:
stock GetName(playerid)
{
new name[24];
GetPlayerName(playerid, name, 24);
return 1;
}
pawn Код:
By ******
Format Use
L(true/false) Optional logical truthity
l Logical truthity
B(binary) Optional binary number
b Binary number
N(any format number) Optional number
n Number
C(character) Optional character
c Character
I(integer) Optional integer
i Integer
D(integer) Optional integer
d Integer
H(hex value) Optional hex number
h Hex number
O(octal value) Optional octal value
o Octal value
F(float) Optional floating point number
f Floating point number
G(float/INFINITY/-INFINITY/NAN/NAN_E) Optional float with IEEE definitions
g Float with IEEE definitions
{ Open quiet section
} Close quiet section
P<delimiter> Invalid delimiter change
p<delimiter> Delimiter change
Z(string)[length] Invalid optional string
z(string)[length] Deprecated optional string
S(string)[length] Optional string
s[length] String
U(name/id) Optional user (bot/player)
u User (bot/player)
Q(name/id) Optional bot (bot)
q Bot (bot)
R(name/id) Optional player (player)
r Player (player)
A<type>(default)[length] Optional array of given type
a<type>[length] Array of given type
E<specification>(default) Optional enumeration of given layout
e<specification> Enumeration of given layout
'string' Search string
% Deprecated optional specifier prefix