Help ?
#1

Hi guys,Im using dcmd_ and I dont know why if a cmd is wrong he doesnt he get Unknown command I have this

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(register,8,cmdtext);
	dcmd(login,5,cmdtext);
	dcmd(report,6,cmdtext);
	dcmd(kick,4,cmdtext);
	dcmd(freeze,6,cmdtext);
	dcmd(unfreeze,8,cmdtext);
	dcmd(ban,3,cmdtext);
	dcmd(adminclron,10,cmdtext);
	dcmd(adminclroff,11,cmdtext);
	dcmd(mute,4,cmdtext);
return 1;
// but if I turn to 0; in every cmd I get unknown cmd...help pl0z
Reply
#2

You missed a bracket.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(register,8,cmdtext);
    dcmd(login,5,cmdtext);
    dcmd(report,6,cmdtext);
    dcmd(kick,4,cmdtext);
    dcmd(freeze,6,cmdtext);
    dcmd(unfreeze,8,cmdtext);
    dcmd(ban,3,cmdtext);
    dcmd(adminclron,10,cmdtext);
    dcmd(adminclroff,11,cmdtext);
    dcmd(mute,4,cmdtext);

return 0;
}
And it's meant to be a 0.
Reply
#3

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	{
	dcmd(register,8,cmdtext);
	dcmd(login,5,cmdtext);
	dcmd(report,6,cmdtext);
	dcmd(kick,4,cmdtext);
	dcmd(freeze,6,cmdtext);
	dcmd(unfreeze,8,cmdtext);
	dcmd(ban,3,cmdtext);
	dcmd(adminclron,10,cmdtext);
	dcmd(adminclroff,11,cmdtext);
	dcmd(mute,4,cmdtext);
	dcmd(unmute,6,cmdtext);
	dcmd(announce,8,cmdtext);
	dcmd(akill,5,cmdtext);
	dcmd(setlevel,8,cmdtext);
	dcmd(admins,6,cmdtext);
	dcmd(aunjail,7,cmdtext);
	dcmd(ajail,5,cmdtext);
	dcmd(a,1,cmdtext);
	dcmd(admincmds,9,cmdtext);
	dcmd(cmds,4,cmdtext);
	dcmd(tlmeto,6,cmdtext);
	dcmd(tltome,6,cmdtext);
	dcmd(disarm,6,cmdtext);
	dcmd(afake,5,cmdtext);
	dcmd(gmx,3,cmdtext);
	dcmd(asay,4,cmdtext);
	dcmd(@,1,cmdtext);
	dcmd(aheal,5,cmdtext);
	dcmd(givearmour,10,cmdtext);
	dcmd(giveweapon,10,cmdtext);
	dcmd(spec,4,cmdtext);
	dcmd(specoff,7,cmdtext);
	dcmd(clearchat,9,cmdtext);
	dcmd(force,5,cmdtext);
	dcmd(setskin,7,cmdtext);
	dcmd(setallskin,10,cmdtext);
	dcmd(armourall,9,cmdtext);
	dcmd(getinfo,7,cmdtext);
	dcmd(unbanip,7,cmdtext);
	dcmd(slap,4,cmdtext);
	dcmd(superslap,9,cmdtext);
	dcmd(resetmoney,10,cmdtext);
	dcmd(superslapall,12,cmdtext);
	dcmd(resetallmoney,13,cmdtext);
	dcmd(kickall,7,cmdtext);
	dcmd(adminskinoff,12,cmdtext);
	dcmd(adminskinon,11,cmdtext);
	dcmd(tltomeall,9,cmdtext);
	dcmd(pspawn,6,cmdtext);
	dcmd(disablecmd,10,cmdtext);
	dcmd(disablechat,11,cmdtext);
	dcmd(disablecmdall,13,cmdtext);
	dcmd(givecash,8,cmdtext);
	dcmd(freezeall,9,cmdtext);
	dcmd(unfreezeall,11,cmdtext);
	dcmd(setallweather,13,cmdtext);
	dcmd(weatherids,10,cmdtext);
	dcmd(viewcmds,8,cmdtext);
	dcmd(playsound,9,cmdtext);
	dcmd(muteall,7,cmdtext);
	dcmd(godme,5,cmdtext);
	}
	return 0;
}
its like that
Reply
#4

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(register,8,cmdtext);
	dcmd(login,5,cmdtext);
	dcmd(report,6,cmdtext);
	dcmd(kick,4,cmdtext);
	dcmd(freeze,6,cmdtext);
	dcmd(unfreeze,8,cmdtext);
	dcmd(ban,3,cmdtext);
	dcmd(adminclron,10,cmdtext);
	dcmd(adminclroff,11,cmdtext);
	dcmd(mute,4,cmdtext);
	dcmd(unmute,6,cmdtext);
	dcmd(announce,8,cmdtext);
	dcmd(akill,5,cmdtext);
	dcmd(setlevel,8,cmdtext);
	dcmd(admins,6,cmdtext);
	dcmd(aunjail,7,cmdtext);
	dcmd(ajail,5,cmdtext);
	dcmd(a,1,cmdtext);
	dcmd(admincmds,9,cmdtext);
	dcmd(cmds,4,cmdtext);
	dcmd(tlmeto,6,cmdtext);
	dcmd(tltome,6,cmdtext);
	dcmd(disarm,6,cmdtext);
	dcmd(afake,5,cmdtext);
	dcmd(gmx,3,cmdtext);
	dcmd(asay,4,cmdtext);
	dcmd(@,1,cmdtext);
	dcmd(aheal,5,cmdtext);
	dcmd(givearmour,10,cmdtext);
	dcmd(giveweapon,10,cmdtext);
	dcmd(spec,4,cmdtext);
	dcmd(specoff,7,cmdtext);
	dcmd(clearchat,9,cmdtext);
	dcmd(force,5,cmdtext);
	dcmd(setskin,7,cmdtext);
	dcmd(setallskin,10,cmdtext);
	dcmd(armourall,9,cmdtext);
	dcmd(getinfo,7,cmdtext);
	dcmd(unbanip,7,cmdtext);
	dcmd(slap,4,cmdtext);
	dcmd(superslap,9,cmdtext);
	dcmd(resetmoney,10,cmdtext);
	dcmd(superslapall,12,cmdtext);
	dcmd(resetallmoney,13,cmdtext);
	dcmd(kickall,7,cmdtext);
	dcmd(adminskinoff,12,cmdtext);
	dcmd(adminskinon,11,cmdtext);
	dcmd(tltomeall,9,cmdtext);
	dcmd(pspawn,6,cmdtext);
	dcmd(disablecmd,10,cmdtext);
	dcmd(disablechat,11,cmdtext);
	dcmd(disablecmdall,13,cmdtext);
	dcmd(givecash,8,cmdtext);
	dcmd(freezeall,9,cmdtext);
	dcmd(unfreezeall,11,cmdtext);
	dcmd(setallweather,13,cmdtext);
	dcmd(weatherids,10,cmdtext);
	dcmd(viewcmds,8,cmdtext);
	dcmd(playsound,9,cmdtext);
	dcmd(muteall,7,cmdtext);
	dcmd(godme,5,cmdtext);
	return 1;
}

dcmd_aheal(playerid, params[])
{
    new ID;
	if (sscanf(params, "u", ID)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: \"/heal [playerid]\"");
	else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFFFFFFFF, "SERV: Player not found!");
	else
    {
         SetPlayerHealth(ID, 100);
         SendClientMessage(ID, "You got healed by admin %s", playerid);
         SendClientMessage(playerid, "You've healed %s", ID);
    }
    return 0;
}
There you have a command that sets the players hp to 100

and ban command here, where you enter id or name and a reason of ban. DOES NOT store in a file

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(register,8,cmdtext);
	dcmd(login,5,cmdtext);
	dcmd(report,6,cmdtext);
	dcmd(kick,4,cmdtext);
	dcmd(freeze,6,cmdtext);
	dcmd(unfreeze,8,cmdtext);
	dcmd(ban,3,cmdtext);
	dcmd(adminclron,10,cmdtext);
	dcmd(adminclroff,11,cmdtext);
	dcmd(mute,4,cmdtext);
	dcmd(unmute,6,cmdtext);
	dcmd(announce,8,cmdtext);
	dcmd(akill,5,cmdtext);
	dcmd(setlevel,8,cmdtext);
	dcmd(admins,6,cmdtext);
	dcmd(aunjail,7,cmdtext);
	dcmd(ajail,5,cmdtext);
	dcmd(a,1,cmdtext);
	dcmd(admincmds,9,cmdtext);
	dcmd(cmds,4,cmdtext);
	dcmd(tlmeto,6,cmdtext);
	dcmd(tltome,6,cmdtext);
	dcmd(disarm,6,cmdtext);
	dcmd(afake,5,cmdtext);
	dcmd(gmx,3,cmdtext);
	dcmd(asay,4,cmdtext);
	dcmd(@,1,cmdtext);
	dcmd(aheal,5,cmdtext);
	dcmd(givearmour,10,cmdtext);
	dcmd(giveweapon,10,cmdtext);
	dcmd(spec,4,cmdtext);
	dcmd(specoff,7,cmdtext);
	dcmd(clearchat,9,cmdtext);
	dcmd(force,5,cmdtext);
	dcmd(setskin,7,cmdtext);
	dcmd(setallskin,10,cmdtext);
	dcmd(armourall,9,cmdtext);
	dcmd(getinfo,7,cmdtext);
	dcmd(unbanip,7,cmdtext);
	dcmd(slap,4,cmdtext);
	dcmd(superslap,9,cmdtext);
	dcmd(resetmoney,10,cmdtext);
	dcmd(superslapall,12,cmdtext);
	dcmd(resetallmoney,13,cmdtext);
	dcmd(kickall,7,cmdtext);
	dcmd(adminskinoff,12,cmdtext);
	dcmd(adminskinon,11,cmdtext);
	dcmd(tltomeall,9,cmdtext);
	dcmd(pspawn,6,cmdtext);
	dcmd(disablecmd,10,cmdtext);
	dcmd(disablechat,11,cmdtext);
	dcmd(disablecmdall,13,cmdtext);
	dcmd(givecash,8,cmdtext);
	dcmd(freezeall,9,cmdtext);
	dcmd(unfreezeall,11,cmdtext);
	dcmd(setallweather,13,cmdtext);
	dcmd(weatherids,10,cmdtext);
	dcmd(viewcmds,8,cmdtext);
	dcmd(playsound,9,cmdtext);
	dcmd(muteall,7,cmdtext);
	dcmd(godme,5,cmdtext);
	return 1;
}

dcmd_ban(playerid, params[])
{
	new
		id,
		reason[64];
	if (sscanf(params, "uz", id, reason)) SendClientMessage(playerid, 0xFF0000AA, "USAGE: \"/ban <playerid/name> <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;
}
UNTESTED
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)