Laserpoint to give
#1

Quote:

C:\Users\aspire\Desktop\FIN-GTA\gamemodes\None.pwn(17523) : error 033: array must be indexed (variable "color")

Script
Quote:

if(strcmp(cmd, "/lasertoy", true) == 0)
{
new tmp2[128],slot,color[32], string2[128];
tmp2 = strtok(cmdtext, idx);

if(!strlen(tmp2)) {
SendClientMessage(playerid, 0xFFFFFFAA,"[USAGE] /lasertoy [playerid] [slot][color]");
return 1;
}
giveplayerid = strval(tmp2);

tmp2 = strtok(cmdtext, idx);
if(!strlen(tmp2)) {
SendClientMessage(playerid, 0xFFFFFFAA,"[USAGE] /lasertoy [playerid] [slot][color]");
return 1;
}
slot = strval(tmp2);

tmp2 = strtok(cmdtext, idx);
if(!strlen(tmp2)) {
SendClientMessage(playerid, 0xFFFFFFAA,"[USAGE] /lasertoy [playerid] [slot][color]");
return 1;
}
color = strval(tmp2);

if (IsPlayerConnected(giveplayerid))
{
if(strcmp(color,"red",true) == 0)
{
PlayerToyInfo[giveplayerid][slot][ptModelID] = 18643;
PlayerToyInfo[giveplayerid][slot][ptBone] = 6;
PlayerToyInfo[giveplayerid][slot][ptPosX] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptPosY] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptPosZ] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotX] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotY] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotZ] = 0.0;
}
else if(strcmp(color,"green",true) == 0)
{
PlayerToyInfo[giveplayerid][slot][ptModelID] = 19083;
PlayerToyInfo[giveplayerid][slot][ptBone] = 6;
PlayerToyInfo[giveplayerid][slot][ptPosX] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptPosY] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptPosZ] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotX] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotY] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotZ] = 0.0;
}
}
else
{
format(string2, sizeof(string2), "<ERROR> %d is not connected!", giveplayerid);
SendClientMessage(playerid, COLOR_RED, string2);
}
return 1;
}

Reply
#2

the error explains everything
C:\Users\aspire\Desktop\FIN-GTA\gamemodes\None.pwn(17523) : error 033: array must be indexed (variable "color")

color[IndexHere] = strval(tmp2);

index that like you did when you made this

new color[32]

also fix your indentation that looks terrible
Reply
#3

OK Thanks.
Reply
#4

i can't fix
Reply
#5

Help please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)