28.04.2011, 12:20
Код:
format(string, 256, " ^^ Administrators %s izbanoja speletaju %s! Reason: %s!", GetName(playerid), GetName(id), reason);
why dont show reason?
sorry for my bad english
format(string, 256, " ^^ Administrators %s izbanoja speletaju %s! Reason: %s!", GetName(playerid), GetName(id), reason);
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; }
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;
}
C:\Users\user\Desktop\RiverSide Community\gamemodes\rsgm.pwn(274) : error 033: array must be indexed (variable "reason")
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;
}