Need help, where am i making mistake. . .
#1

pawn Код:
if(strcmp(vtmp, "buyvehicle", true) == 0){
                if(IsPlayerInRangeOfPoint(playerid,5.0,-1967.774291,293.854766,34.986248)){
                    vehiclebuyid = strtok(cmdtext, idx);
                    if(strlen(vehiclebuyid) == 0){
                        new show = sizeof(buyablevehicles);
                        new show2 = show / 3;
                        for(new v; v<show2; v++){
                            vi = v * 3;
                            format(vtext, sizeof(vtext), "ID: %d - Name: %s, Price: %d$ | ID: %d - Name: %s, Price: %d$ | ID: %d - Name: %s, Price: %d$", buyablevehicles[vi][0], buyablevehicles[vi][1], buyablevehicles[vi][2], buyablevehicles[vi+1][0], buyablevehicles[vi+1][1], buyablevehicles[vi+1][2], buyablevehicles[vi+2][0], buyablevehicles[vi+2][1], buyablevehicles[vi+2][2]);
                            SendClientMessage(playerid, COLOR_YELLOW,vtext);
                        }
                        return 1;
                    }
                }
            }
it return ID and Name ok but Price if it is 15000 it retur 97, does any one know why?
Reply
#2

Its looks like miscalculation, maybe you don't have that sizeof show2 as buyablevehicles
Reply
#3

you didn't understand, if i have 16 cars it return 5 rows and every thing is fine except Price, it return some other number. . . i tried everything but i didn't made it to work
Reply
#4

sorry for double post
but here is buyablevehicles,
firs number is modelid, then its vehicle name, and then price

pawn Код:
new buyablevehicles[][15] = {
{400, "Landstalker", 15000},
{401, "Bravura", 10000},
{402, "Buffalo", 50000},
{404, "Perenniel", 8000},
{405, "Sentinel", 30000},
{410, "Manana", 8000},
{411, "Infernus", 80000},
{412, "Voodoo", 25000},
{413, "Pony", 25000},
{415, "Cheetah", 100000},
{418, "Moonbeam", 25000},
{419, "Esperanto", 30000},
{421, "Washington", 35000},
{422, "Bobcat", 20000},
{424, "Injection", 40000},
{426, "Premier", 45000}
};
Reply
#5

Ohh,, size 15 is not enough, use some 32, but that will not a fix your bug.

and why you use

for(new v; v<show2; v++) ??

use

new buyablevehicles[16][32] = {

and

for(new v; v<sizeof(buyablevehicles); v++)

but I dont think that will also fix your bug, I actually can't see a script bug atm
Reply
#6

Quote:
Originally Posted by ikey07
Посмотреть сообщение
Ohh,, size 15 is not enough, use some 32, but that will not a fix your bug.

and why you use

for(new v; v<show2; v++) ??

use

new buyablevehicles[16][32] = {

and

for(new v; v<sizeof(buyablevehicles); v++)

but I dont think that will also fix your bug, I actually can't see a script bug atm
for(new v; v<sizeof(buyablevehicles); v++) i used this but it show every vehicle in new line so i put like this this will print if i have 16 vehicles in array it will print 3 in one line, so that's why i use with show, and i can't do buyablevehicles[16][32] because i don't know how many vehicles i will have
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)