Array must be indexed.
#1

Hey guys, today i was trying to make "Car wanted" system.. but i stuck.



pawn Код:
Error : proba.pwn(53) : error 033: array must be indexed (variable "wantedmodel")
pawn Код:
#include <a_samp>
#include <zcmd>
#include <streamer>

#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_LIME 0x10F441AA
#define COLOR_RED 0xFF0000AA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_WHITE 0xFFFFFFAA

#define MAX_CP 100
new CP[MAX_CP];
new randompick;//should it be global ?
new wantedmodel[3];//is this right ?
forward Time();
forward VehPick();
new wantedcars[][][]=
{
    {405, 10000, "Car"},
    {522,  5000, "Bike"}
    //model, price, name..
};
public VehPick()
{
        new msg[128];
    randompick = random(sizeof(wantedcars)); // should it remain new randompick = ...  ?
    //How can i let script know what model (wantedcars[randompick][0]) is picked ?
    format(wantedmodel,sizeof(wantedmodel),"%d",wantedcars[randompick][0]);//i have no idea where im going with this.. :D
    format(msg,sizeof(msg),"[WANTED CAR]: bla bla %s bla bla $%d!",wantedcars[randompick][2],wantedcars[randompick][1]); //we look for,we pay for..
    SendClientMessageToAll(COLOR_WHITE,msg);
    SetTimer("Time",15000,false);
}
public Time()
{
    VehPick();
}
public OnGameModeInit()
{
    AddPlayerClass(2,2261.3000000,-83.4000000,26.1000000,100.0000000,0,0,0,0,0,0);
    VehPick();
    AddStaticVehicleEx(410,405.2999900,2535.1001000,16.3000000,0.0000000,94,112,15); //Manana
    AddStaticVehicleEx(405,2276.5000000,-84.5000000,26.4000000,76.0000000,32,32,15); //Sentinel
    AddStaticVehicleEx(522,2261.3000000,-83.4000000,26.1000000,100.0000000,109,122,15); //NRG-500
    CP[0] = CreateDynamicCP(2263.6418,-131.5671,27.4688,10.0,-1,-1,-1,50.0); // Final destination :D
    return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == CP[0])
    {
        new Veh = GetPlayerVehicleID(playerid);
        new VehModel = GetVehicleModel(Veh);
        if(VehModel == wantedmodel) >>>> [Error line]
        {
            //give player money ..
        }
    }
    return 1;
}
Reply


Messages In This Thread
Array must be indexed. - by Djumza - 20.03.2017, 22:02
Re: Array must be indexed. - by ISmokezU - 20.03.2017, 22:06
Re: Array must be indexed. - by Djumza - 21.03.2017, 11:20
Re: Array must be indexed. - by coool - 21.03.2017, 11:27
Re: Array must be indexed. - by Djumza - 21.03.2017, 11:47
Re: Array must be indexed. - by coool - 21.03.2017, 11:51
Re: Array must be indexed. - by Djumza - 21.03.2017, 11:54
Re: Array must be indexed. - by coool - 21.03.2017, 12:00
Re: Array must be indexed. - by Djumza - 21.03.2017, 12:12
Re: Array must be indexed. - by Feynman - 21.03.2017, 14:36
Re: Array must be indexed. - by Djumza - 21.03.2017, 15:38
Re: Array must be indexed. - by Djumza - 22.03.2017, 17:02

Forum Jump:


Users browsing this thread: 1 Guest(s)