(62) : error 028: invalid subscript (not an array or too many subscripts): "Xx"
#1

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 © 1997-2006, ITB CompuPhase


4 Errors.



pawn Код:
// 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"
Reply
#2

use this
pawn Код:
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 ..
Reply
#3

if i want add model == GetPlayerVehicleID(playerid); how ?
Reply
#4

pawn Код:
if( GetVehicleModel( GetPlayerVehicleID(playerid) ) == model ) {  // player's vehicle model and variable model is same, do code
}
Reply
#5

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++;
}
}
}
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)