[Tutorial] How make some easy ZCMD command's for newbie's +Explain
#1

Ok i'll Explain to you guys how make simple /akill
Ok first go to your's ZCMD and do it
Код:
CMD:akill(playerid, params[])
this is your section where's you will make your's Commands
add it on the Top of your server u will use it soon
Код:
new tragetID;
new reason[64];
new str[128];
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];//you will use it later with your sscanf
GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
GetPlayerName(tragetID, Playername, sizeof(Playername));[/CODE]
ok here is the sscanf that mean you making command that will be like /akill (id)(reason)
on other player
Код:
if(sscanf(params, "us[64]", tragetID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /akill [playerid] [reason]");
ok now we need make that only admin can use this command
do it
Код:
if(!IsPlayerAdmin(playerid)) SendClientMessage, COLOR_RED, "you are not admin");
ok we done with it, if u not logged in Rcon so u cannot use this cmd
Код:
if(!IsPlayerConnected(tragetID))//if u did /akill 0 hha and the player not connected so you will get message->
return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
ok now we need add the reason like admin name: have been akilled tragetid: (reason)
ok ad this
Код:
format(str, sizeof(str), "'%s' has been akill by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
SendClientMessageToAll(COLOR_RED, str); //send that message to all
Ok we soon will done
this message will send to eveyone
ok now we need add it
to kill the player after u type /akill
add this
SetPlayerHealth(tragetID, 0);
Ok now we done
NOTE
this is my first TUT so please don't be made
if you not like it so please leave this Section
i'm newbie to
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)