SA-MP Forums Archive
[IRC Help] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [IRC Help] (/showthread.php?tid=121166)



[IRC Help] - Doppeyy - 15.01.2010

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


Re: [IRC Help] - Joe Staff - 15.01.2010

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


Re: [IRC Help] - Doppeyy - 15.01.2010

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


Re: [IRC Help] - Joe Staff - 15.01.2010

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


Re: [IRC Help] - Doppeyy - 15.01.2010

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