message for banned
#1

I am trying to make a message going to the player that got banned say "You have been banned for x Day(s).
here is what im working with

pawn Код:
format(string,128,"**  ADMIN BAN: %s has been banned - %s ",giveplayer,days,reason);
                SendClientMessageToAll(adminpink,string);
                SendClientMessage(playerid, adminpink, " ** Banned for %d Day(s). Next time listen.",days);
there is obv more but this is the part im working with. Where the playerid is, idk what to put there. i know playerid sends to the person that made the /tempban.
Reply
#2

What is the problem?
Reply
#3

i want the banned player to see a message saying "Banned for X day(s).. it already sends a message to all saying that Player has been banned. But it doesnt send the banned person a private message saying how long. Where it says Playerid (3rd line) idk what to put there to send it to the banned person

pawn Код:
SendClientMessage(playerid, adminpink, " ** Banned for %d Day(s). Next time listen.",days);
Reply
#4

(7825) : error 017: undefined symbol "string2"
pawn Код:
format(string2,128,"** Banned for %d Day(s). Next time listen.",days);
(7826) : error 035: argument type mismatch (argument 1)
pawn Код:
SendClientMessage(giveplayer, adminpink,string2);
Reply
#5

(7827) : error 035: argument type mismatch (argument 1)
pawn Код:
SendClientMessage(giveplayer, adminpink,string2);
Reply
#6

pawn Код:
if(strcmp(cmd, "/tempban", true) == 0)
    {
        new name[MAX_PLAYER_NAME];
        new giveplayer[MAX_PLAYER_NAME];
        new giveplayerid;
       
        if(AccInfo[playerid][Level] >= 4)
        {
            tmp = strtok(cmdtext,idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, LIGHTBLUE2, "Usage: /tempban [PlayerID] [Day(s)] [Reason]");
                SendClientMessage(playerid, orange, "Function: Temporarily bans a player for specified Days");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
                tmp = strtok(cmdtext, idx);
                if (!strlen(tmp))
                {
                SendClientMessage(playerid, LIGHTBLUE2, "Usage: /tempban [PlayerID] [Day(s)] [Reason]");
                SendClientMessage(playerid, orange, "Function: Temporarily bans a player for specified Days");
                return 1;
                }
                new days = strval(tmp);
                if(!IsNumeric(tmp))
                return SendClientMessage(playerid, lightred, "ERROR: Invalid Day! Only Numbers!");
               
                if(strval(tmp) <= 0 || strval(tmp) > 1000)
                return SendClientMessage(playerid, lightred, "ERROR: Invalid Day! (1-1000)");

                new reason[128];
                reason = strtok2(cmdtext,idx);
                if (!strlen(reason))
                return SendClientMessage(playerid, lightred, "ERROR: Reason not Specified!");
               
                if (strlen(reason) <= 0 || strlen(reason) > 100)
                return SendClientMessage(playerid, lightred, "ERROR: Invalid Reason length!");
               
                new ip[15];
                GetPlayerIp(giveplayerid,ip,15);
                GetPlayerName(playerid, name, sizeof name);
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                new File:tempban = fopen("LuxAdmin/Config/TempBans.ban", io_append);
                if (tempban)
                {
                    new year,month,day;
                    getdate(year, month, day);
                    day += days;
                    if (IsMonth31(month))
                    {
                        if (day > 31)
                        {
                            month += 1;
                            if (month > 12)
                            {
                                year += 1;
                                while(day > 31) day -= 31;
                            }
                            else while(day > 31) day -= 31;
                        }
                    }
                    else if (!IsMonth31(month))
                    {
                        if (day > 30)
                        {
                            month += 1;
                            if (month > 12)
                            {
                                year += 1;
                                while(day > 30) day -= 30;
                            }
                            else while(day > 30) day -= 30;
                        }
                    }
                    else if (!IsMonth31(month) && IsMonth29(year) && month == 2)
                    {
                        if (day > 29)
                        {
                            month += 1;
                            if (month > 12)
                            {
                                year += 1;
                                while(day > 29) day -= 29;
                            }
                            else while(day > 29) day -= 29;
                        }
                    }
                    else if (!IsMonth31(month) && !IsMonth29(year) && month == 2)
                    {
                        if (day > 28)
                        {
                            month += 1;
                            if (month > 12)
                            {
                                year += 1;
                                while(day > 28) day -= 28;
                            }
                            else while(day > 28) day -= 28;
                        }
                    }
                    format(string, sizeof string, "%d|%d|%d|%s\n", day, month, year, ip);
                    fwrite(tempban, string);
                    fclose(tempban);
                }
                new string2[256];
                format(string,128,"**  ADMIN BAN: %s has been banned - %s ",giveplayer,days,reason);
                SendClientMessageToAll(adminpink,string);
                format(string2,128,"** Banned for %d Day(s). Next time listen.",days);
               
                Kick(giveplayerid);
               
                format(string, sizeof string, "**  ADMIN BAN: %s has been banned for %d Day(s) - %s",giveplayer,days,reason);
                SaveIn("TempBansLog",string);
            }
            else
            {
            ErrorMessages(playerid, 2);
            }
        }
        else return ErrorMessages(playerid, 1);
        return true;
    }
Reply
#7

same error
error 035: argument type mismatch (argument 2)
pawn Код:
SendClientMessage(adminpink,string2);
i think argument 2 is saying the string2 part isnt right
Reply
#8

Quote:
Originally Posted by googamalugafoo
Посмотреть сообщение
same error
error 035: argument type mismatch (argument 2)
pawn Код:
SendClientMessage(adminpink,string2);
i think argument 2 is saying the string2 part isnt right
That's because there's no target

EDIT: try

pawn Код:
SendClientMessage(giveplayerid, 0xFF00FFAA, string2);
Reply
#9

EDIT: Thanks worked perfect.
Reply
#10

just change
pawn Код:
new string2[256];
to
pawn Код:
new string2[128];
Because later it will create problems later.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)