PDA

View Full Version : (62) : error 028: invalid subscript (not an array or too many subscripts): "Xx"


xFirex
23/06/2013, 08:09 AM
help

(62) : error 028: invalid subscript (not an array or too many subscripts): "Xx"
(62) : warning 215: expression has no effect
(62) : error 001: expected token: ";", but found "]"
(62) : error 029: invalid expression, assumed zero
(62) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.




// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <easydialog>
#include <zcmd>

#define Loop(%0,%1) for(new %0 = 0; %0 < %1; %0++)

#define MAX_VEHICLE 20// change this

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

new Float:Xx, Float:Yy, Float:Zz;

new model[MAX_VEHICLE];

new PlayerVeh[MAX_VEHICLE];

new Float:angle;

CMD:saveveh(playerid, params[])
{
#pragma unused params
ShowDialog(playerid, Show:Save, DIALOG_STYLE_INPUT, "{009900}GVeh-Vehicle Saving", "{FF0000}Warning! {FFFFFF}You're about to save cars to a file.\nYou must include the .txt tag at the end of the filename.\nAll existing text in the file you're saving to will be overwritten.\n\nEnter the filename where you want to save the cars below:", "Save", "Cancel");
return 1;
}

Dialog:Save(playerid, response, listitem, inputtext[])
{
return SaveCarsToFile(playerid, inputtext);
}


stock SaveCarsToFile(playerid, filename[], sendmsg = 1)
{
new File:gFile, string[158], count;
if(strlen(filename) < 4) return SendClientMessage(playerid, -1, "{FF0000}Error! {FFFFFF}The filename you entered is shorter than 4 characters. Minimum filename is 4 characters including the .txt extension.");
if(strfind(filename, ".txt", true) == -1) return SendClientMessage(playerid, -1, "{FF0000}Error! {FFFFFF}The filename you entered didn't have the .txt extension at the end. Please add it and continue.");
else
{
if(fexist(filename))
{
fremove(filename);
}
gFile = fopen(filename, io_write);
fclose(gFile);
gFile = fopen(filename, io_append);
Loop(o, MAX_VEHICLE)
{
if(PlayerVeh[o] == playerid && model[o] != -1)
{
GetPlayerPos(playerid,Xx,Yy,Zz);
GetPlayerFacingAngle(playerid,angle);
format(string, sizeof(string), "CreateVehicle(%d, %f, %f, %f, %0.2f, 1 ,1, 60 );\r\n", model[o], Xx[o], Yy[o], Zz[o],angle[o]);//error line
fwrite(gFile, string);
count++;
}
}
fclose(gFile);
if(sendmsg == 1)
{
format(string, sizeof(string), "{009900}Save Successfull{FFFFFF}! Saved{009900} %d{FFFFFF} objects to {009900}%s{FFFFFF}.", count, filename);
SendClientMessage(playerid, COLOUR_INFO, string);
}
}
return 1;
}



error line "format(string, sizeof(string), "CreateVehicle(%d, %f, %f, %f, %0.2f, 1 ,1, 60 );\r\n", model[o], Xx[o], Yy[o], Zz[o],angle[o]);//error line"

Niko_boy
23/06/2013, 08:21 AM
use this
format(string, sizeof(string), "CreateVehicle(%d, %f, %f, %f, %0.2f, 1 ,1, 60 );\r\n", model, Xx, Yy, Zz,angle);//error line

u trying to use a variable as a array ..

xFirex
23/06/2013, 08:28 AM
if i want add model == GetPlayerVehicleID(playerid); how ?

Niko_boy
23/06/2013, 08:34 AM
if( GetVehicleModel( GetPlayerVehicleID(playerid) ) == model ) { // player's vehicle model and variable model is same, do code
}

xFirex
23/06/2013, 08:44 AM
error 033: array must be indexed (variable "model")//61

{
if(PlayerVeh[o] == playerid && model[o] != -1)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == model) // player's vehicle model and variable model is same, do code
{
GetPlayerPos(playerid,Xx,Yy,Zz);
GetPlayerFacingAngle(playerid,angle);
format(string, sizeof(string), "CreateVehicle(%d, %f, %f, %f, %0.2f, 1 ,1, 60 );\r\n", model, Xx, Yy, Zz,angle);//error line
fwrite(gFile, string);
count++;
}
}
}

Niko_boy
23/06/2013, 09:22 AM
oh i see now ur model is an array so
format(string, sizeof(string), "CreateVehicle(%d, %f, %f, %f, %0.2f, 1 ,1, 60 );\r\n", model[o], Xx, Yy, Zz,angle);//error line

sorry mistake. :x