[HELP] can't get vehicle id when I buy a bike
#1

Hello I working on when I buy a bike (bike,bmx,mountain bike) I can't get their's id I try everything but in the file is nothing write in description if you know what I mean. Look:

pawn Код:
new bi = GetFreeBiID();
                    if(PlayerInfo[playerid][Biciklo] == -1) PlayerInfo[playerid][Biciklo] = bi;
                    NovacMinus(playerid, hBiraCenaKes[playerid]);
                    PodesiBiciklo(playerid, bi);
                    new hqwIme[MAX_PLAYER_NAME];
                    RPIme(playerid, hqwIme);
                    BInfo[bi][bhModel] = 509;
                    BInfo[bi][bhBoja1] = 0;
                    BInfo[bi][bhBoja2] = 0;
                    strmid(BInfo[bi][bhVlasnik], hqwIme, 0, strlen(hqwIme), 255);
                    strmid(BInfo[bi][bhDescription], ImenaVozila[GetVehicleModel(BInfo[playerid][bhModel]) - 400], 0, strlen(ImenaVozila[GetVehicleModel(BInfo[playerid][bhModel]) - 400]), 255);
                    BInfo[bi][bck] = 9500;
                    BInfo[bi][bhImaVlasnika] = 1;
                    BInfo[bi][bhZakljucan] = 0;
                    PlayerInfo[playerid][BicikloZakljucano] = 0;
                    SCM(playerid, BELA,"Cestitamo na kupovini bicikla!");
                    SCM(playerid, BELA,"Komande su: /bi(ciklo)!");
                    SCM(playerid, ZUTA,"Ovo je vasa prva kupnja. Da kreirate vase biciklo, kucajte /bi kreiraj!");
                    VozilaUSalonu--;
                    IgracevoBiciklo[playerid] = bi;
the problem is in the code:

pawn Код:
strmid(BInfo[bi][bhDescription], ImenaVozila[GetVehicleModel(BInfo[playerid][bhModel]) - 400], 0, strlen(ImenaVozila[GetVehicleModel(BInfo[playerid][bhModel]) - 400]), 255);
Reply
#2

Here you set the model on 509 for the index N (N is the value of bi).
pawn Код:
BInfo[bi][bhModel] = 509;
and then:
pawn Код:
GetVehicleModel(BInfo[playerid][bhModel])
You're trying to get the model of the index N (N is the value of playerid) which are two different values. Even if you change playerid to bi, GetVehicleModel is expecting the vehicleid and you'll try to pass 509 for it (it might be invalid).

So what do you want to do with those above?
Reply
#3

I just want get bike idd to be written in the file or the name of vehicle bike if you know what I mean and the name or id is written thru this:

this part

pawn Код:
strmid(BInfo[bi][bhDescription]
and in that line after , I must put the code which I get the name or id of that vehicle
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)