[Tutorial] PAWN Beginners: Creating IRC Commands
#1

Hello guys, Today I will show you a tutorial about "Creating IRC Commands" , I will show you how to create commands like !say

Requirements: IRC Plugin, IRC Include, You can find it over here : IRC Plugin

Okay Lets begin now.

Step 1:

Open pawno.exe and open your gamemode or create a filterscript

:
Go to top of your script near #include <a_samp> or any other include add this line
Code:
#include <irc>
Step 3:
Go at the OnGameModeInit function end or OnFilterScriptInit end and do like this:
Code:
IRCCMD:myirccommand(botid, channel[], user[], host[], params[])
{
  // Add here what will it do like this command will kick player id 1
Step 4:
After adding your code like what will it do like Kick etc.. add this at the end of command:
Code:
   }
   return 1;
}
Step 5:
Looks like you are done creating it now...
Well this is a example how it will look like:
Code:
 IRCCMD:kickid1(botid, channel[], user[], host[], params[])
{
   if (IRC_IsOp(botid, channel, user)) 
   {
   SendClientMessage(1,-1," You were removed from the server by %s from the IRC", user);
   Kick(1);
   new string[128];
   format(msg, sizeof(string), "**NOTICE: %s has kicked ID 1 out of the server**", user); // This is to announce it to the  in IRC
   Say(channel,string);
   format(msg, sizeof(string), "**NOTICE:ID 1 has been kicked by %s from the server IRC**", user);
   SendMessageToAll(-1, string);
   }
   return 1;
}
Step 6:
Now start mIRC or the IRC Program like mIRC and connect to your server. Download mIRC from here == download

Step 7:
Now go in game , get in server and go to mIRC program and enter IRC and add your command in the chat box. Example :
Code:
!kickid1 - If I used that, It'll kick whoever has ID 1 with a message that he has been kicked by you
Thats all... You are finished now.. Enjoy!
Notice: If you like it or learn something please +REP me I really need it.
Reply
#2

Instead of the command being kickid1 you could bring in sscanf and use sscanf to do it so like

PHP Code:
 IRCCMD:kickid(botidchannel[], user[], host[], params[])
{
   new 
PID;
   
GetPlayerName(PIDplayernamesizeof(playername));
   if(
sscanf(params"u"PID) return SendClientMessage(playerid, -1"USAGE: /kickid [playerid]);
   if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, -1, "
Player is not connected); 
   if (
IRC_IsOp(botidchanneluser)) 
   {
   
SendClientMessage(1,-1," You were removed from the server by %s from the IRC"user);
   
Kick(PID);
   new 
string[128];
   
format(msgsizeof(string), "**NOTICE: %s has kicked %s out of the server**"user,playername); // This is to announce it to the  in IRC
   
Say(channel,string);
   
format(msgsizeof(string), "**NOTICE:%s has been kicked by %s from the server IRC**"playername,user);
   
SendMessageToAll(-1string);
   }
   return 
1;

I have no idea if that works but it might and it will kick what ever player/id you type hopefully
Reply
#3

You don't even need to use sscanf for this command, you can simply check through params. This isn't even a tutorial at all, you're explaining nothing and writing weird codes.
Reply
#4

When I looked at the title - OMG another shitty do-this-do-that tutorial?

When I looked at the main post - OMG another shitty do-this-do-that tutorial

courtesy thefatshizms
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)