[Tutorial] How to make a /disarm cmd
#1

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
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
Step 2
You need colors so we need to #define COLOR_RED
pawn Код:
#define COLOR_RED 0xFF0006FF
Step 3
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];
Step 4
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;
}
Also we need GetName Stock Dont what what is stock? visit: https://sampwiki.blast.hk/wiki/Stocks

pawn Код:
stock GetName(playerid)
{
new name[24];
GetPlayerName(playerid, name, 24);
return 1;
}
All the specifiers:

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
Reply
#2

Nice Work Good Job
Reply
#3

Quote:
Originally Posted by mehdi171996
Посмотреть сообщение
Nice Work Good Job
Thanks
Reply
#4

Good job
+rep
Reply
#5

Quote:
Originally Posted by Luminar
Посмотреть сообщение
Good job
+rep
Thanks
Reply
#6

GOOD
Reply
#7

Nicely done She790
Reply
#8

Sorry, but this tutorial is really bad. First of all, about three quarters of the entire thing is spent on stuff you might need as well, but not on the actual command. And instead of explaining what the command does, and how it works and why it works like that, you just paste a few lines of code and a few comments behind them.

I've always found tutorials for a single command useless, and this is a perfect example why.
Reply
#9

Just Like Inifiniy Say,The Tutorial Is To Bad !
Reply
#10

Not much of a tutorial, you might as-well have made a script and released it as a standalone Fliterscript, seen as you're not teaching anything.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)