12.12.2009, 12:06
(
Last edited by Jakku; 27/01/2013 at 01:25 PM.
)
----
format(reason, sizeof (reason), "%s has been Kicked.%s%s",pName2, reason[0] ? (" Reason: ") : (""), reason); SendClientMessage(id, COLOR_BRIGHTRED, reason);
if(!strcmp(cmdtext, "/kick", true, 5))
{
if(!strlen(cmdtext[6]))
{
SendClientMessage(playerid, COLOR_ORED, "Usage: /kick [playerid] [reason]");
return 1;
}
new ID = strval(cmdtext[6]);
new pName[24], kickername[24], stri[64], strv[256],tmp[256], reason2[64];
if(IsPlayerConnected(ID))
{
GetPlayerName(ID, pName, 24);
tmp = strtok(cmdtext, idx);
reason2 = strval(tmp);
GetPlayerName(playerid, kickername, 24);
//if(Admin4[ID] == 1) return SendClientMessage(playerid, red, "You cannot kick higher level admin than you are!");
format(strv, 64, "~ You have been kicked from the server for ^%s^", reason);
SendClientMessage(ID,COLOR_ORANGE, strv);
Kick(ID);
format(stri, 64, "%s has been kicked from the server", pName);
SendClientMessageToAll(COLOR_ORED, stri);
printf("Admin Log: %s has kicked %s for ^%s^", kickername, pName,reason);
}
return 1;
}
C:\Users\Jani.Kannettava.000\Desktop\Server\gamemodes\paapaaof.pwn(5992) : error 033: array must be indexed (variable "reason2") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
Originally Posted by Jakku
I want it works with strval, do it doesn't display the damning ID front of it.
|
if(strcmp(cmd, "/kick", true) == 0) { new string[256]; new idx; new tmp[256]; new pName2[MAX_PLAYER_NAME]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [playerid] [reason]"); 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++; } new player1 = strval(tmp); result[idx - offset] = EOS; if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [playerid] [reason]"); if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID."); GetPlayerName(player1, pName2, sizeof(pName2)); format(string,sizeof(string),"%s has been kicked.(Reason: %s)", pName2, result); SendClientMessageToAll(COLOR_ORANGE, string); Kick(player1); return 1; }
Originally Posted by Damon_Black
Think of strval as 0,1,2,3,4,5,6, etc
TRUST US you want a string! |