reason dont shows
#1

Код:
format(string, 256, " ^^ Administrators %s izbanoja speletaju %s! Reason: %s!", GetName(playerid), GetName(id), reason);
why when i ban any player servers shows '' administrators hawkz izbanoja speletaju test! Reason: !
why dont show reason?

sorry for my bad english
Reply
#2

Show the whole command.
Reply
#3

First reduce string size to 128.
Show us your full ban command.
Reply
#4

Код:
if(strcmp(cmd, "/ban", true) == 0)
{
  if(GetPVarInt(playerid, "Admin") >= 2)
  {
			new tmp[255],tmp2[255],string[128];
			tmp = strtok(cmdtext, idx);
			tmp2 = strtok(cmdtext, idx);
			new id = strval(tmp);
			new reason = strval(tmp2);
			if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, " *** Usage: /ban [ID] [Reason]");
			if(!strlen(tmp2)) return SendClientMessage(playerid, COLOR_WHITE, " *** Usage: /ban [ID] [Reason]");
			if(!IsPlayerConnected(id)) return SendClientMessage(playerid, grey, " *** ERROR: Player is not connected!");
			format(string, 256, " ^^ Administrator %s banned %s for reason: %s !", GetName(playerid), GetName(id), reason);
			SendClientMessageToAll(COLOR_DEEPPINK, string);
			Ban(id);
  }
  else
  {
    SendClientMessage(playerid, grey, " *** ERROR: You are not 2 or higher level admin!");
  }
  return 1;
}
Reply
#5

pawn Код:
if(strcmp(cmd, "/ban", true) == 0)
{
    if(GetPVarInt(playerid, "Admin") >= 2)
    {
        new tmp[255],tmp2[255],string[128],reason[128];
        tmp = strtok(cmdtext, idx);
        tmp2 = strtok(cmdtext, idx);
        new id = strval(tmp);
        reason = strval(tmp2);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, " *** Usage: /ban [ID] [Reason]");
        if(!strlen(tmp2)) return SendClientMessage(playerid, COLOR_WHITE, " *** Usage: /ban [ID] [Reason]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, grey, " *** ERROR: Player is not connected!");
        format(string, 256, " ^^ Administrator %s banned %s for reason: %s !", GetName(playerid),       GetName(id), reason);
        SendClientMessageToAll(COLOR_DEEPPINK, string);
        Ban(id);
    }
    else
    {
    SendClientMessage(playerid, grey, " *** ERROR: You are not 2 or higher level admin!");
}
return 1;
}
Reply
#6

Код:
C:\Users\user\Desktop\RiverSide Community\gamemodes\rsgm.pwn(274) : error 033: array must be indexed (variable "reason")
Reply
#7

pawn Код:
if(strcmp(cmd, "/ban", true) == 0)
{
    if(GetPVarInt(playerid, "Admin") >= 2)
    {
        new tmp[255],string[128];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, " *** Usage: /ban [ID] [Reason]");
        new id = strval(tmp);
        while(cmdtext[idx] == ' ') idx++;
        if(!strlen(cmdtext[idx])) return SendClientMessage(playerid, COLOR_WHITE, " *** Usage: /ban [ID] [Reason]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, grey, " *** ERROR: Player is not connected!");
        format(string, sizeof(string), " ^^ Administrator %s banned %s for reason: %s !", GetName(playerid), GetName(id), cmdtext[idx]);
        SendClientMessageToAll(COLOR_DEEPPINK, string);
        Ban(id);
    }
    else
    {
        SendClientMessage(playerid, grey, " *** ERROR: You are not 2 or higher level admin!");
    }
    return 1;
}
Reply
#8

MadeMan big thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)