SA-MP Forums Archive
Kick with saving reason - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Kick with saving reason (/showthread.php?tid=104437)



Kick with saving reason - Battlaman - 24.10.2009

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;
}
}




Re: Kick with saving reason - MadeMan - 24.10.2009

Use this:

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



Re: Kick with saving reason - Battlaman - 24.10.2009

Quote:
Originally Posted by MadeMan
Use this:

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