Kick with saving reason
#1

Can anybody tell me why this not work?

I get an error.. at the red line: error 006: must be assigned to an array

Quote:

if(strcmp(cmd, "/ban", true)==0)
{
if (PlayerInfo[playerid][pAdminlevel] >= 102 || IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD, "USAGE: /ban [playerid] [reason]");
return 1;
}
giveplayerid = strval(tmp);
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(!IsPlayerConnected(giveplayerid))
{
SendClientMessage(playerid, COLOR_RED, "That player is not connected"); return 1;
}
if (PlayerInfo[giveplayerid][pAdminlevel] >= 1 || IsPlayerAdmin(giveplayerid))
{
SendClientMessage(playerid, COLOR_RED, "You can not ban an admin with a higher level or a rcon admin!"); return 1;
}
OnPlayerUpdate(giveplayerid);
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
GetPlayerName(giveplayerid, GivePlayerName, sizeof(GivePlayerName));
format(string, sizeof(string), "* Admin %s has banned %s from the server. (reason: %s)", PlayerName,result);
SendClientMessageToAll(COLOR_RED, string);
PlayerInfo[giveplayerid][pBanned] = 1;
PlayerInfo[giveplayerid][pBanReason] = result;
OnPlayerUpdate(giveplayerid);
Kick(giveplayerid);
return 1;
}
else
{
return 1;
}
}

Reply
#2

Use this:

pawn Код:
format(PlayerInfo[giveplayerid][pBanReason], 128, result);
Reply
#3

Quote:
Originally Posted by MadeMan
Use this:

pawn Код:
format(PlayerInfo[giveplayerid][pBanReason], 128, result);
Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)