19.02.2014, 22:51
Ok i have a command to send commands to my NPC so that they can "act" as real players... as of now it just shows the name of the person typing the command and not the NPC's name. :/
Will +rep for whoever helps me.
My code is going to be below
- I've tried adding playerb, and then it does not work at all...
Will +rep for whoever helps me.
My code is going to be below
- I've tried adding playerb, and then it does not work at all...
pawn Code:
CMD:sendcmd(playerid, params[])
{
new npcid, cmd[128], msg[128], sendedcmd[128];
if(sscanf(params, "us[128]s[128]", npcid, cmd, sendedcmd))
{
SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /sendcmd [playerid] [cmd] [cmdparams]");
return 1;
}
if(!IsPlayerConnected(npcid))
{
SendClientMessage(playerid, COLOR_WHITE, "Invalid player!");
return 1;
}
if(!IsPlayerNPC(npcid))
{
SendClientMessage(playerid, COLOR_GREY, "You can only use this command on NPC.");
return 1;
}
if(!strcmp(cmd, "/ban")) return cmd_ban(playerid, sendedcmd);
if(!strcmp(cmd, "/kick")) return cmd_kick(playerid, sendedcmd);
if(!strcmp(cmd, "/slap")) return cmd_slap(playerid, sendedcmd);
if(!strcmp(cmd, "/pm")) return cmd_pm(playerid, sendedcmd);
if(!strcmp(cmd, "/o")) return cmd_o(playerid, sendedcmd);
if(!strcmp(cmd, "/w")) return cmd_w(playerid, sendedcmd);
format(msg, sizeof(msg), "/sendcmd %s.", cmd, sendedcmd);
SendClientMessage(playerid, COLOR_WHITE, msg);
return 1;
}