error 033: array must be indexed
#1

error:
Код:
C:\Users\user\samp\samp\filterscripts\project.pwn(4857) : error 033: array must be indexed (variable "TargetID")
line:
Код:
if(TargetID == INVALID_PLAYER_ID || !IsPlayerConnected(TargetID)) return SendClientMessage(playerid, COLOR_RED, "*Player Is Not Connected.");
Also another one I need help with

error:
Код:
project.pwn(4862) : error 035: argument type mismatch (argument 1)
line:
Код:
GetPlayerName(TargetID,targetname,24);
another line with the same error:
Код:
KickWithMessage(TargetID,"You have been kicked from this server.");
Here is the whole section
Код:
dcmd_kick(playerid, params[])
{
        new TargetID[64];
        if(pInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
        if(sscanf(params, "us", TargetID)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /kick [id]");
        if(TargetID == INVALID_PLAYER_ID || !IsPlayerConnected(TargetID)) return SendClientMessage(playerid, COLOR_RED, "*Player Is Not Connected.");
        else
        {
               new str1[128];
               new targetname[MAX_PLAYER_NAME];
               GetPlayerName(TargetID,targetname,24);
               format(str1,sizeof(str1),"**KICK: %s (%d) Reason: %s", targetname, TargetID);
               SendClientMessageToAll(COLOR_HOTPINK, str1);
               KickWithMessage(TargetID,"You have been kicked from this server.");
               print(str1);
        }
        return 1;
}
thanks
Reply
#2

You defined TargetID as an array, while you're using it as an integer.
pawn Код:
new TargetID[64];
This will fix it.
pawn Код:
new TargetID;
Also, I noticed you supplied sscanf to extract a playerid AND a string ("us"), but you only specified TargetID to store the data.
Just removed the "s" from it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)