SA-MP Forums Archive
help with IRC - 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)
+--- Thread: help with IRC (/showthread.php?tid=337902)



help with IRC - ColdRain - 28.04.2012

i created command work on player with name i did this line


if(isnull(params,ammount);
return IRC_Say(gGroupID, channel, "02USAGE: !setrob [PlayerName] [AMMOUNT]");


but its stay give me error on the the thing ammount i did new ammount;

Here is full command

pawn Код:
IRCCMD:setrob(botid, channel[], user[], host[], params[])
{

    new string[128],            ammount;
    if(!IRC_IsHalfop(botid, channel, user) && !IRC_IsOp(botid, channel, user) && !IRC_IsAdmin(botid, channel, user))
    return IRC_Say(gGroupID,channel,"02You can't use this commands");
    if(isnull(params,ammount);  <----- // Error Line
        return IRC_Say(gGroupID, channel, "02USAGE: !setrob [PlayerName] [AMMOUNT]");

    format(string,sizeof(string), ": Server IRC Has Setted Your RobSkills To %s",ammount);
    SendClientMessage(ID,COLOR_RED,string);
    format(string, sizeof(string), "%s has had thier RobSkills setted to  by IRC %s", params, ammount, user);
    IRC_GroupSay(gGroupID,channel,string);
    format(string,sizeof(string),"You have setted %s RobSkills to  On IRC.",params,ammount);
    IRC_Say(gGroupID,channel,string);
    dUserSetINT(params).("robrank",ammount);
    return 1;
}



Re: help with IRC - Vince - 28.04.2012

isnull expects only one parameter. You forgot to add sscanf in the command.


Re: help with IRC - ColdRain - 28.04.2012

can you explain how i can do it ?


Re: help with IRC - TheArcher - 28.04.2012

Download sscanf from here. https://sampforum.blast.hk/showthread.php?tid=120356 , put the include in your pawno/includes and .dll file into your plugins folder and add sscanf on server.cfg should be like
Код:
echo Executing Server Config...
lanmode 0
rcon_password ????
maxplayers 500
port 7777
hostname SA-MP 0.3 Server
gamemode0 lvdm 1
filterscripts
announce 0
query 1
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 500
logtimeformat [%H:%M:%S]
plugins crashdetect sscanf
Then include sscanf on your .pwn file which could be like

pawn Код:
#include <a_samp>
#include <core>
#include <float>
#include <cnpc>
#include <zcmd>
#include <sscanf2>
then just edit
pawn Код:
if(isnull(params,ammount);  <----- // Error Line
        return IRC_Say(gGroupID, channel, "02USAGE: !setrob [PlayerName] [AMMOUNT]");
into
pawn Код:
if(sscanf(params, "d", ammount)) return IRC_Say(gGroupID, channel, "02USAGE: !setrob [PlayerName] [AMMOUNT]");
Here you go.


Re: help with IRC - Niko_boy - 28.04.2012

Код HTML:
if(sscanf(params,"ui",pname,amount)) return IRC_Say(gGroupID, channel, "02USAGE: !setrob [PlayerName] [AMMOUNT]");
thats it
u have to create new var and pName
+ instead of
Код HTML:
if(!IRC_IsHalfop(botid, channel, user) && !IRC_IsOp(botid, channel, user) && !IRC_IsAdmin(botid, channel, user))
    return IRC_Say(gGroupID,channel,"02You can't use this commands");
just do
Код HTML:
if(!IRC_IsHalfop(botid, channel, user) return IRC_Say(gGroupID,channel,"02You can't use this commands");
^ because the one who is Op is halfop too and one who is Admin is OP too xD so..

EDIT: @ archer ahah u few min faster + mistake in sscanf format sscanf(params,"d" only while he want palyer name and amount xD


Re: help with IRC - TheArcher - 28.04.2012

@Niko_boy i didn't know he want PlayerName. Anyways you're doing a little mistake too. As i see you've put PlayerName which you need an array + "u" parameter is used for UserID not for names. so that returns the player ID not its name.
Edit + E.g:

Your example:

pawn Код:
if(sscanf(params,"ui",pname,amount)) return IRC_Say(gGroupID, channel, "02USAGE: !setrob [PlayerName] [AMMOUNT]");
That could return 0 and 1 (0 Player ID and Channel 1)

Mine method could be
pawn Код:
new pname[MAX_PLAYER_NAME];
pawn Код:
GetPlayerName(playerid, pname, sizeof pname);
pawn Код:
if(sscanf(params,"s[24]i",pname,amount)) return IRC_Say(gGroupID, channel, "02USAGE: !setrob [PlayerName] [AMMOUNT]");
That could return Myname and 1 (Player name and channel 1)


Re: help with IRC - Niko_boy - 28.04.2012

lol xD yeah i did s[24] earlier dunno why i edited that ,my lame :P

so the finaly is : -
Quote:

if(sscanf(params,"s[24]i",pname,amount)) return IRC_Say(gGroupID, channel, "02USAGE: !setrob [PlayerName] [AMMOUNT]");




Re: help with IRC - TheArcher - 28.04.2012

Quote:
Originally Posted by Niko_boy
Посмотреть сообщение
lol xD yeah i did s[64] earlier dunno why i edited that ,my lame :P

so the finaly is : -
You posted after while i was edited, take a look above

Why 64 cells, you need only 24 cells beacuse players name can't go above 24 characters.


Re: help with IRC - Niko_boy - 28.04.2012

DAfq my keyboard i pressed 6 instead of 2 lOL and didnt even noticed thanks again for the fix -.-
[guess i have been much off topic already]


Re: help with IRC - TheArcher - 28.04.2012

Quote:
Originally Posted by Niko_boy
Посмотреть сообщение
DAfq my keyboard i pressed 6 instead of 2 lOL and didnt even noticed thanks again for the fix -.-
[guess i have been much off topic already]
We've just tried to help him out nothing much, just beacuse only we have replied here. And anyways the fixed code is posted above, cause i forgot to get the player name :P