Dcmd - Simple job cmd
#1

Im not getting dcmd.. and every tutorial ive read have the same output: i don't understand it.

Could somone make a good example how dcmd works? i need to use it in many cases but for now i need it to change a players job.

example structure:

Код:
dcmd_job(playerid, params[])
{
   If cmd contains "criminal" check for Money if its under the limit then dont let the player get the job
   If cmd is wrong, send message with usage.
   If players job isnt citizen send message that player have to resign.
   If cmd = /job criminal and money is above the limit and player is citizen, let the player get the criminal job.
   Set job and kick.
}
Reply
#2

Wtf? xD dcmd is for using commands like /ban or /anims or other commands.
Learn to use it here: https://sampwiki.blast.hk/wiki/Dcmd
Reply
#3

This is a code from sa-mp wiki, it's a good example for dcmd+sscanf.

Код:
dcmd_ban(playerid, params[])
{
	new
		id,
		reason[64];
	if (sscanf(params, "uz", id, reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ban <playerid/partname> <reason (optional)>\"");
	else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
	else
	{
		BanEx(id, reason);
		format(reason, sizeof (reason), "You have been banned%s%s.", reason[0] ? (" for: ") : (""), reason);
		SendClientMessage(id, 0xFF0000AA, reason);
		SendClientMessage(playerid, 0x00FF00AA, "Player banned");
	}
	return 1;
}
If you still don't understand cut you be more specific with what you don't understand.
Reply
#4

So, dcmd is mainly for administration cmds?

Cant i use dcmd for making a cmd like i structured?
Reply
#5

Of course you can.
Reply
#6

Quote:
Originally Posted by Flashy
Wtf? xD dcmd is for using commands like /ban or /anims or other commands.
Learn to use it here: https://sampwiki.blast.hk/wiki/Dcmd
- What's this all about then?..
Reply
#7

dcmd is a way to create fast commands.

If you wanna create commands that show players help or intructions then make it with stcmp:

Quote:

if(strcmp(cmd, "/help", true) == 0)
{
SendClientMessage(playerid, COLOR_GREEN,"Help bla bla");
return true;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)