(95) : error 033: array must be indexed (variable "tmp")
(96) : error 033: array must be indexed (variable "tmp")
(97) : error 033: array must be indexed (variable "tmp")
(98) : error 033: array must be indexed (variable "tmp")
(99) : error 033: array must be indexed (variable "tmp")
(100) : error 033: array must be indexed (variable "tmp")
(101) : error 033: array must be indexed (variable "tmp")
(101) : warning 213: tag mismatch
(102) : error 033: array must be indexed (variable "tmp")
(104) : error 033: array must be indexed (variable "tmp")
(106) : error 029: invalid expression, assumed zero
(106) : error 033: array must be indexed (variable "tmp")
(106) : error 029: invalid expression, assumed zero
(106) : fatal error 107: too many error messages on one line
if(strcmp(cmd, "/createlocation", true)==0 || strcmp(cmd, "/createloc", true)==0) //example: /createloc 2
{
new str[128],tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_USAGE,"USAGE: /createlocation [Location ID]");
new Float:X,Float:Y,Float:Z,Float:A,Interior;
new pName[MAX_PLAYER_NAME];
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,A);
Interior = GetPlayerInterior(playerid);
GetPlayerName(playerid, pName, sizeof(pName));
LocInfo[tmp][LocX] = X; // Float
LocInfo[tmp][LocY] = Y; // Float
LocInfo[tmp][LocZ] = Z; // Float
LocInfo[tmp][LocA] = A; // Float
LocInfo[tmp][LocInterior] = Interior;
LocInfo[tmp][LocCreator] = pName;
LocInfo[tmp][AvailableTeleport] = 1; // Bool
format(str, 128, "You have succesfully set saved location %d to the following settings:",LocInfo[tmp][LocNumber]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "Coordinations: %.2f,%.2f,%.2f",LocInfo[tmp][LocX],LocInfo[tmp][LocY],LocInfo[tmp][LocZ]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "Angle: %.1f",,LocInfo[tmp][LocA]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "Interior: %d",LocInfo[tmp][LocInterior]);
SendClientMessage(playerid, COLOR_BPINK, str);
PlayerPlaySound(playerid,1138,X,Y,Z);
return 1;
}
"tmp" is a string, you can't use it to index an array, only numbers can be used for that. I would strongly recommend using sscanf for this to extract the data out of the strings.
|
if(strcmp(cmd, "/createlocation", true)==0 || strcmp(cmd, "/createloc", true)==0)
{
new str[128],tmp[256],location;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_USAGE,"USAGE: /createlocation [Location ID]");
if(tmp < 1 || tmp > 100) return SendClientMessage(playerid,COLOR_WARNING,"Warning: The location number must be between 1 to 100!");
new Float:X,Float:Y,Float:Z,Float:A,Interior;
new pName[MAX_PLAYER_NAME];
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,A);
Interior = GetPlayerInterior(playerid);
GetPlayerName(playerid, pName, sizeof(pName));
location = tmp;
LocInfo[location][LocX] = X;
LocInfo[location][LocY] = Y;
LocInfo[location][LocZ] = Z;
LocInfo[location][LocA] = A;
LocInfo[location][LocInterior] = Interior;
LocInfo[location][LocCreator] = pName;
format(str, 128, "You have succesfully set saved location %d to the following settings:",LocInfo[location][LocNumber]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "Coordinations: %.2f,%.2f,%.2f",LocInfo[location][LocX],LocInfo[location][LocY],LocInfo[location][LocZ]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "Angle: %.1f",LocInfo[location][LocA]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "Interior: %d",LocInfo[location][LocInterior]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "From now on people can teleport to this location by typing: /gotoloc [%d]",LocInfo[location][LocNumber]);
SendClientMessage(playerid, COLOR_BPINK, str);
PlayerPlaySound(playerid,1138,X,Y,Z);
SaveLocations();
return 1;
}