Help with a ban command y_ini saving ''reason''
#1

Okay so i tried everything to get this work properly but it's driving me nuts. I want that ''reason'' is saved in //
pawn Код:
PlayerInfo[playerid][pBanReason] = reason;
but i can't manage to get it work i keep getting 006 error and when i use
pawn Код:
format(PlayerInfo[playerid][pBanReason], 128, "%s", reason);
i got saved under reason number 84 .Any help would be appriciated.Thanks

pawn Код:
YCMD:ban(playerid, params[], help)
{

                new id, reason[128], str[128], str1[128], str2[128],str3[128] mins, sec, year, month, day;
                if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin]<=1338)
                if (sscanf(params, "ds[128]", id, reason)) SendClientMessage(playerid, COLOR_INFO, "Usage: \"/ban [playerid] [reason]\"");
                else if (!IsPlayerConnected(id)) SendClientMessage(playerid, COLOR_RED, "Invalid id");
                else
          //      if (!IsPlayerConnected(id)) SendClientMessage(playerid, COLOR_YELLOW, "Invalid id");
                {
                     
                        gettime(hour, mins, sec);
                        getdate(year, month, day);
                        //PlayerInfo[playerid][pBanReason] = reason;
                        format(str, 128, "Time: %i:%i Date: %i/%i/%i", hour, mins, day, month, year);
                        SendClientMessage(id, COLOR_RED, str);
                        format(str1, 128, "Admin: %s Banned: %s Reason: %s", GetName(playerid),GetName(playerid), reason);
                        SendClientMessageToAll(COLOR_RED,str1);
                        format(str2, 128, "You have been Banned from the server by Admin: %s Reason: %s",GetName(playerid), reason);
                        SendClientMessage(id, COLOR_RED, str2);
                       format(str3, 128, "~r~~h~Banned ~n~~r~");
                GameTextForPlayer(id, str3, 6000, 3);
           
                        PlayerInfo[playerid][pBanned]= 1;
                     //   format(PlayerInfo[playerid][pBanReason], 128, "%s", reason);
                    //    PlayerInfo[playerid][pBanReason] = reason;
                        Kick(id);
                }
                else
                {
                SendClientMessage(playerid, COLOR_YELLOW, "You are not authorized to use that command!");
                }
                return 1;

}
Reply
#2

shouldn't it be

pawn Код:
new string[128];
format(string, sizeof(string), "%s", reason);
Reply
#3

Show how you create pBanReason in the enum.
Reply
#4

you have to add [128] by pBanReason in the enum
Reply
#5

Quote:
Originally Posted by Kitten
Посмотреть сообщение
shouldn't it be

pawn Код:
new string[128];
format(string, sizeof(string), "%s", reason);
He has done that :/

" // format(PlayerInfo[playerid][pBanReason], 128, "%s", reason);
// PlayerInfo[playerid][pBanReason] = reason;"

PlayerInfo[playerid][pBanReason] = String
128 = sizeof
%s = string identifer
reason = string.
Reply
#6

Why you use Ycmd? There are better ways to script.
Reply
#7

Quote:
Originally Posted by Kitten
Посмотреть сообщение
shouldn't it be

pawn Код:
new string[128];
format(string, sizeof(string), "%s", reason);
That wont work since it will save 0

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Show how you create pBanReason in the enum.
pBanReason[128],

Quote:
Originally Posted by Mellnik
Посмотреть сообщение
you have to add [128] by pBanReason in the enum
pBanReason[128],

pawn Код:
if (sscanf(params, "ds[128]", id, reason)) SendClientMessage(playerid, COLOR_INFO, "Usage: \"/ban [playerid] [reason]\"");
format(PlayerInfo[playerid][pBanReason], 128, "%s", reason);
PlayerInfo[playerid][pBanReason] = reason;
Output of this in save file is 84 no matter what i put under /ban id reason
Reply
#8

Also using "r" instead of "d" in sscanf would be usefull

if(sscanf(params, "rs[128]", player, reason))
{...}
Reply
#9

pawn Код:
PlayerInfo[playerid][pBanReason] = reason;
should be

pawn Код:
format(PlayerInfo[playerid][pBanReason], 50, reason);
Reply
#10

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
pawn Код:
PlayerInfo[playerid][pBanReason] = reason;
should be

pawn Код:
format(PlayerInfo[playerid][pBanReason], 50, reason);
It is same what i use this above or format ban reason is always 84. All this didn't helped problem is same anyone have idea
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)