Problem with CreateDynamic3DTextLabel on car
#1

Hello, i have a problem.

When use /createvehicle she say me: command does not exist but car spawned and label not showing.



Код:
	new string[248];
    format(string, sizeof(string), ""COL_GREEN"[VOZILO NA PRODAJU]\nIme vozila: "COL_WHITE"%s \n"COL_GREEN"Stanje: "COL_WHITE"Novo \n"COL_GREEN"Cijena:"COL_WHITE"%d", VehicleNames[GetVehicleModel(model) - 400], price);
    VehicleLabel[vehID] = CreateDynamic3DTextLabel(string, COLOR_GREEN, -1, -1, -1, 20.0, INVALID_PLAYER_ID, vehID, 1, -1, -1, -1, 20.0);
i have
Код:
new Text3D: VehicleLabel[MAX_VEHICLES];
on server_log:
Код:
[18:16:16] [debug] Run time error 4: "Array index out of bounds"
[18:16:16] [debug]  Accessing element at negative index -400
[18:16:16] [debug] AMX backtrace:
[18:16:16] [debug] #0 0007fdc8 in public cmd_createvehicle (0, 20104552) from usrpbeta.amx
[18:16:16] [debug] #1 native CallLocalFunction () from samp-server.exe
[18:16:16] [debug] #2 00011ccc in ?? (0, 20104444) from usrpbeta.amx
[18:16:16] [debug] #3 000061e8 in public OnPlayerCommandText (0, 20104444) from usrpbeta.amx
Reply
#2

Код:
GetVehicleModel(model)
->
Код:
GetVehicleModel(GetPlayerVehicleID(playerid))
Try that, just incase 'model' isn't your player vehicleid.
Reply
#3

again not showing
Reply
#4

pawn Код:
new string[248];
format(string, sizeof(string), ""COL_GREEN"[VOZILO NA PRODAJU]\nIme vozila: "COL_WHITE"%s \n"COL_GREEN"Stanje: "COL_WHITE"Novo \n"COL_GREEN"Cijena:"COL_WHITE"%d", VehicleNames[model], price);
VehicleLabel[vehID] = CreateDynamic3DTextLabel(string, COLOR_GREEN, -1, -1, -1, 20.0, INVALID_PLAYER_ID, vehID, 1, -1, -1, -1, 20.0);
Reply
#5

Quote:
Originally Posted by Dragony92
Посмотреть сообщение
pawn Код:
new string[248];
format(string, sizeof(string), ""COL_GREEN"[VOZILO NA PRODAJU]\nIme vozila: "COL_WHITE"%s \n"COL_GREEN"Stanje: "COL_WHITE"Novo \n"COL_GREEN"Cijena:"COL_WHITE"%d", VehicleNames[model], price);
VehicleLabel[vehID] = CreateDynamic3DTextLabel(string, COLOR_GREEN, -1, -1, -1, 20.0, INVALID_PLAYER_ID, vehID, 1, -1, -1, -1, 20.0);
Again same problem.

But when remove this function for name of car, now not showing message for command not exist, now command work good, but label not showing.. :S
Reply
#6

someone?
Reply
#7

You should post more code as we don't even know how "model" has been used.

Before retrieving the name, you need to make sure that GetVehicleModel does NOT return 0 because you will get the run time error 4 for accessing element at negative index -400.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)