invalid subscript? House system...
#1

I have this

pawn Код:
if(strcmp(option,"garage") == 0)
    {
        for(new i; i < MAX_HOUSES; i++)
        {
            new pname[24];
            GetPlayerName(playerid,pname,sizeof(pname));
            if(IsPlayerInRangeOfPoint(playerid,1.0,HouseInfo[i][hX],HouseInfo[i][hY],HouseInfo[i][hZ]))
            {
                for(new gc; gc < MAX_GARAGE_CAR; i++)
                {
                    new count = 0;
                    SendClientMessage(playerid,COLOR_RED,"");
                    SendClientMessage(playerid,COLOR_GREEN,"________________|YOUR GARAGE|________________");
                    SendClientMessage(playerid,COLOR_RED,"");
                    if(HouseInfo[i][GarageCar[gc]] > 0) // this line
                    {
                        format(string, sizeof(string), "Name: %s (ID:%i)",GetVehicleName(HouseInfo[i][GarageCar[gc]]),gc); // this line too
                        SendClientMessage(playerid,COLOR_CYAN,string);
                        count++;
                    }
                    if(count == 0)
                    SendClientMessage(playerid,COLOR_RED,"You don't have any cars in your house garage!");
                    SendClientMessage(playerid,COLOR_GREEN,"_________________________________________________");
                }
            }
        }
    }
Errors

pawn Код:
WHouse.pwn(447) : error 028: invalid subscript (not an array or too many subscripts): "GarageCar"
WHouse.pwn(447) : warning 215: expression has no effect
WHouse.pwn(447) : error 001: expected token: ";", but found "]"
WHouse.pwn(447) : error 029: invalid expression, assumed zero
WHouse.pwn(447) : 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.
================ READY ================
problem is the HouseInfo[i][GarageCar[gc]]... Here's the variable

pawn Код:
enum E_HOUSE_INFO
{
    Name[24],
    Owner[24],
    Owned,
    Level,
    Price,
    GarageCar[MAX_GARAGE_CAR],
    Float:hX,
    Float:hY,
    Float:hZ,
    hVirtual,
    Text3D:hLabel,
}
new HouseInfo[MAX_HOUSES][E_HOUSE_INFO];
Reply
#2

it should be:
pawn Код:
HouseInfo[i][GarageCar][gc]
Reply
#3

Thank you but when i loop the

pawn Код:
for(new i; i < something; i++)
But i want it to show 1 message how can i do that?
Reply
#4

Quote:
Originally Posted by xganyx
Посмотреть сообщение
Thank you but when i loop the

pawn Код:
for(new i; i < something; i++)
But i want it to show 1 message how can i do that?
What? Explain it in a better way please.
Reply
#5

like this

i use

pawn Код:
#define MAX_HOUSES 10

CMD:createhouse(playerid,params[])
{
    for(new i; i < MAX_HOUSES; i++)
    {
        //i do the stuff here and finaly i want to send message for player
        SendClientMessage(playerid,COLOR_RED,"House: CREATED"); // i just want to send 1 message but it send 10 message in the loop MAX_HOUSES...
    }
    return 1;
}
Reply
#6

Then use it out of the loop.

pawn Код:
for(new i; i < MAX_HOUSES; i++)
{
    // do stuff here
}
SendClientMessage(playerid,COLOR_RED,"House: CREATED");
Reply
#7

Can't because this

pawn Код:
if(strcmp(option,"garage") == 0)
    {
        for(new i; i < MAX_HOUSES; i++)
        {
            new pname[24];
            GetPlayerName(playerid,pname,sizeof(pname));
            if(IsPlayerInRangeOfPoint(playerid,1.0,HouseInfo[i][hX],HouseInfo[i][hY],HouseInfo[i][hZ]))
            {
                for(new gc; gc < MAX_GARAGE_CAR; i++)
                {
                    new count = 0;
                    SendClientMessage(playerid,COLOR_RED,"");//this
                    SendClientMessage(playerid,COLOR_GREEN,"________________|YOUR GARAGE|________________");//this
                    SendClientMessage(playerid,COLOR_RED,"");//this
                    if(HouseInfo[i][GarageCar[gc]] > 0)
                    {
                        format(string, sizeof(string), "Name: %s (ID:%i)",GetVehicleName(HouseInfo[i][GarageCar[gc]]),gc);
                        SendClientMessage(playerid,COLOR_CYAN,string);
                        count++;
                    }
                    if(count == 0)
                    SendClientMessage(playerid,COLOR_RED,"You don't have any cars in your house garage!");// this
                    SendClientMessage(playerid,COLOR_GREEN,"_________________________________________________");// this
                }
            }
        }
    }
Reply
#8

I really can't understand you. Please explain it with simple words. What do you want to do and why you cannot to do that?
Reply
#9

pawn Код:
// These at the top:
#define COLOR_RED 0xFF0000FF
#define COLOR_GREEN 0x00FF00FF

//And this at the cmd:
if(strcmp(option,"garage") == 0)
    {
        for(new i; i < MAX_HOUSES; i++)
        {
            new pname[24];
            GetPlayerName(playerid,pname,sizeof(pname));
            if(IsPlayerInRangeOfPoint(playerid,1.0,HouseInfo[i][hX],HouseInfo[i][hY],HouseInfo[i][hZ]))
            {
                for(new gc; gc < MAX_GARAGE_CAR; i++)
                {
                    new count = 0;
                    SendClientMessage(playerid,COLOR_RED,"");//this
                    SendClientMessage(playerid,COLOR_GREEN,"________________|YOUR GARAGE|________________");//this
                    SendClientMessage(playerid,COLOR_RED,"");//this
                    if(HouseInfo[i][GarageCar][gc] > 0)
                    {
                        format(string, sizeof(string), "Name: %s (ID:%i)",GetVehicleName(HouseInfo[i][GarageCar][gc]),gc);
                        SendClientMessage(playerid,COLOR_CYAN,string);
                        count++;
                    }
                    if(count == 0)
                    SendClientMessage(playerid,COLOR_RED,"You don't have any cars in your house garage!");// this
                    SendClientMessage(playerid,COLOR_GREEN,"_________________________________________________");// this
                }
            }
        }
    }
Reply
#10

What are you talking about that's just send the message ________________|YOUR GARAGE|________________ like

________________|YOUR GARAGE|________________
________________|YOUR GARAGE|________________
________________|YOUR GARAGE|________________
________________|YOUR GARAGE|________________
________________|YOUR GARAGE|________________
________________|YOUR GARAGE|________________
________________|YOUR GARAGE|________________
________________|YOUR GARAGE|________________
________________|YOUR GARAGE|________________

in the loop but i can't move it out of the loop... How can i make it just 1 message like this

________________|YOUR GARAGE|________________
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)