SA-MP Forums Archive
Laserpoint to give - 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)
+--- Thread: Laserpoint to give (/showthread.php?tid=452982)



Laserpoint to give - arititlez - 23.07.2013

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




Re: Laserpoint to give - DemCaribous - 23.07.2013

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


Re: Laserpoint to give - arititlez - 23.07.2013

OK Thanks.


Re: Laserpoint to give - arititlez - 23.07.2013

i can't fix


Re: Laserpoint to give - arititlez - 23.07.2013

Help please