[IRC Help]
#1

Hey guys i have a irc FS i found here on the forum.
But i want to add a /report command if people use it on the server we will see it in IRC.
This is what i have now.

Can someone pleae help me ?

[Doppeyy
Reply
#2

Pretty simple

pawn Код:
if(!strcmp(cmdtext[1],"report",true,6))
{
  new ply = strfind(cmdtext," ",true,8);
  new msg[128];
  format(msg,sizeof(msg),cmdtext[ply]);
  if(!msg[1])return SendClientMessage(playerid,0xFF0000FF,"USAGE: /Report <id> <message>");
  ply = strval(cmdtext[8]);
  if(!IsPlayerConnected(ply))return SendClientMessage(playerid,0xFF0000FF,"That player is not connected.");
  new name1[MAX_PLAYER_NAME];
  new name2[MAX_PLAYER_NAME];
  GetPlayerName(playerid,name1,sizeof(name1));
  GetPlayerName(ply,name2,sizeof(name2));
  format(msg,sizeof(msg),"%s reported %s for %s",name1,name2,msg);
  IrcSay(msg);
  return 1;
}
It actually is simple, I just made it more complicated by not using any pre-made structure functions like scanf, strtok, or DCMD
Reply
#3

Quote:
Originally Posted by Joe Staff
Pretty simple

pawn Код:
if(!strcmp(cmdtext[1],"report",true,6))
{
  new ply = strfind(cmdtext," ",true,8);
  new msg[128];
  format(msg,sizeof(msg),cmdtext[ply]);
  if(!msg[1])return SendClientMessage(playerid,0xFF0000FF,"USAGE: /Report <id> <message>");
  ply = strval(cmdtext[8]);
  if(!IsPlayerConnected(ply))return SendClientMessage(playerid,0xFF0000FF,"That player is not connected.");
  new name1[MAX_PLAYER_NAME];
  new name2[MAX_PLAYER_NAME];
  GetPlayerName(playerid,name1,sizeof(name1));
  GetPlayerName(ply,name2,sizeof(name2));
  format(msg,sizeof(msg),"%s reported %s for %s",name1,name2,msg);
  IrcSay(msg);
  return 1;
}
It actually is simple, I just made it more complicated by not using any pre-made structure functions like scanf, strtok, or DCMD
So i just have to add that and it will work.

[Doppeyy
Reply
#4

Assuming you add it into the right place, yes. under OnPlayerCommandText
Reply
#5

Quote:
Originally Posted by Joe Staff
Assuming you add it into the right place, yes. under OnPlayerCommandText
Yeah sorry i could think that on my own i wasnt thinkin straight .
Thank you for your help tho.

[Doppeyy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)