20.02.2014, 10:06
Now that I think about it, this might make more sense:
pawn Code:
CMD:sendcmd(playerid, params[])
{
new npcid, actualcmd[30], cmdparams[150];
if(sscanf(params, "us[30]S[150]", npcid, actualcmd, cmdparams)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sendcmd [playerid] [cmd] [cmdparams]");
if(cmdparams[0] != '/') return SendClientMessage(playerid, COLOR_WHITE, "Invalid command entered.");
if(!IsPlayerConnected(npcid)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid player!");
if(!IsPlayerNPC(npcid)) return SendClientMessage(playerid, COLOR_GREY, "You can only use this command on an NPC.");
format(actualcmd, sizeof(actualcmd), "cmd_%s", actualcmd);
CallRemoteFunction(actualcmd, "is", npcid, cmdparams);
return 1;
}