We tried to reducing the array sizes but it no effect to the mode.
Heres the kick and ban source code:
Code:
if(strcmp(cmd, "/ban", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] <= 2)
{
SendClientMessage(playerid, COLOR_GRAD1, "You dont have permissions!");
SecondLifeInfoBox(playerid, "You cannot use this command~n~because you are not an admin.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Use: /ban [PlayerID/PartOfTheName] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 3)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Use: /ban [PlayerID/PartOfTheName] [reason]");
return 1;
}
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "[ADMIN]: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
BanLog(string);
AdminLog(string);
format(string, sizeof(string), "[ADMIN]: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
SendClientMessageToAll(COLOR_LIGHTRED, string);
new ipaddress[16];
GetPlayerIp(giveplayerid,ipaddress,sizeof(ipaddress));
new BannedReason[126];
format(BannedReason, sizeof(BannedReason), "Banned. Reason: %s", (result));
Ban(giveplayerid);
Kick(giveplayerid);
return 1;
}
}//not connected
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
The Kick Command:
Code:
if(strcmp(cmd, "/kick", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] <= 1)
{
SendClientMessage(playerid, COLOR_GRAD1, "You dont have permission!");
SecondLifeInfoBox(playerid, "You cant use this command~n~because you are not an admin.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Use: /kick [PlayerID/PartOfTheName] [Reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 2)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Use: /kick [PlayerID/PartOfTheName] [Reason]");
return 1;
}
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "[ADMIN]: %s has been kicked by %s, Reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
KickLog(string);
format(string, sizeof(string), "[ADMIN]: %s has been kicked by %s, Reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
SendClientMessageToAll(COLOR_RED, string);
Kick(giveplayerid);
return 1;
}
}
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
But not only with these 2 commands do this the server.The all command who want an ID for command do this.
Plss help