[Tutorial] How to Make a Command That Bans an Offline Player [ZCMD + y_ini + Sscanf]
#21

Thanks. If anyone has a problem, feel free to ask.
Reply
#22

That is under the DIALOG_REGISTER like you said.

Код:
INI_WriteString(File, "Ip", IP, 22);
warning 202: number of arguments does not match definition
Reply
#23

My bad. Fixed now. Thanks.
Reply
#24

pawn Код:
new INI:File = INI_Open(UserPath(filestring));
// error 035: argument type mismatch (argument 1)
Reply
#25

Well I got a little problem, I tried those codes, but when I test it, it doesn't work. So I try to find it out, then I remove the [24] from

Quote:

if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, -1, "COMMAND: /banofflineplayer [Player's name]")

Then it works properly, so I guess it doesn't need to add [24] into "s". Beside that you've added the [24] into targetname. Well if I was wrong, please give me the right answer, cause I'm a newbie , Thank you very much BTW.
Reply
#26

Good!!!
Reply
#27

Im going to use this thanks !
Reply
#28

Wow, nice.
Reply
#29

Great! But how to ban all offline players or unban?
Please show.
Reply
#30

You'll have to loop through all the user files. Which from what I know is impossible in pawn without using a plugin.

ThaCrypte, Ryu-: All fixed long ago. Sorry for not replying.
Reply
#31

Plugin exist? Where can I download it?
Tnx.
Reply
#32

Thanks for notifying me. Sscanf link has been fixed.
Reply
#33

pawn Код:
(2217) : error 028: invalid subscript (not an array or too many subscripts): "BannedIP"
(2217) : warning 215: expression has no effect
(2217) : error 001: expected token: ";", but found "]"
(2217) : error 029: invalid expression, assumed zero
(2217) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Line 2217:
pawn Код:
format(cmdstring, sizeof(cmdstring), "unbanip %s", BannedIP[playerid]);
pawn Код:
CMD:unbanofflineplayer(playerid, params[])
{
    new string[128],tname[24];
    if(sscanf(params, "s[24]", tname)) return SendClientMessage(playerid,-1,"Correct Usage: /unbanofflineplayer [Player Name] ");
    new filestring[79];
    format(filestring, sizeof(filestring), "/Users/%s.ini", tname);
    if(!fexist(filestring)) return SendClientMessage(playerid, -1, "The name you've chosen was not found in our database ");
    else
    {
        new INI:File = INI_Open(filestring);
        INI_SetTag(File, "data");
        INI_WriteInt(File, "Banned",0);
        INI_Close(File);
        INI_ParseFile(filestring, "LoadIP_%s", .bExtra = true , .extra = playerid);
        new cmdstring[44];
        format(cmdstring, sizeof(cmdstring), "unbanip %s", BannedIP[playerid]);
        SendRconCommand(cmdstring);
        SendRconCommand("reloadbans");
        new done[128];
        format(done, sizeof(done),"You have successfully unbanned %s", tname);
        SendClientMessage(playerid, -1,done);
    }
    return 1;
}
Reply
#34

Thank you for telling me!

It should be:

pawn Код:
PlayerInfo[playerid][BannedIP]
Sorry about that.
Reply
#35

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
Thank you for telling me!

It should be:

pawn Код:
PlayerInfo[playerid][BannedIP]
Sorry about that.
Its Okay, Thank you for the tut.
Reply
#36

Nice tutorial.
Reply
#37

pawn Код:
warning 235: public function lacks forward declaration (symbol "LoadIP_data")
You haven't forwarded it in the tutorial
pawn Код:
public LoadIP_data(playerid, name[], value[])
And it'd be good if you could add reason?
Reply
#38

Nice.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)