09.11.2014, 12:54
(
Последний раз редактировалось dazman14; 09.11.2014 в 13:56.
)
I've been scripting for years but i'm clueless as to why this script doesn't work proparly. Propably a simple mistake somewhere... So my problem is that GetVehicleSQLID isn't working i did a debug using command /carsql that i made. I've taken the relevant code out of my script to get some help on this.
here is the debug command (I use this in a car) :
and it returned SERVER: Command does not exist
enum:
Vehilce spawning:
GetVehicleSQLID(vehid):
I appreciate all the help you guys give. I never really ask for it as i seem to solve problems rather well but this one has got me.
My main questionm is: What is causing GetVehicleSQLID to not work?
Darren (Dazman14)
here is the debug command (I use this in a car) :
and it returned SERVER: Command does not exist
Код:
command(carsql, playerid, params[]) { new string[100]; new vehid = GetPlayerVehicleID(playerid); format(string, sizeof(string), "The sql id of this vehicle is: %d. ", GetVehicleSQLID(vehid)); SendClientMessage(playerid, COLOR_WHITE, string); return 1; }
Код:
enum VehicleStats{ id, perm, model, Float:vx, Float:vy, Float:vz, Float:va, c1, c2, plate[8], lock, GameID }; new Vehicle[MAX_VEHICLE][VehicleStats];
Код:
stock LoadDynamicVehicles() { new Str[128], VehicleID, i = 0; mysql_query("SELECT * FROM `vehicles`"); mysql_store_result(); if(mysql_num_rows() != 0) { while(mysql_fetch_row(Str)) { sscanf(Str, "p<|>iiiffffiis[10]", VehicleID, Vehicle[i][perm], Vehicle[i][model], Vehicle[i][vx], Vehicle[i][vy], Vehicle[i][vz], Vehicle[i][va], Vehicle[i][c1], Vehicle[i][c2], Vehicle[i][plate]); SetVehicleNumberPlate(Vehicle[i][GameID] = CreateVehicle(Vehicle[i][model], Vehicle[i][vx], Vehicle[i][vy], Vehicle[i][vz], Vehicle[i][va], Vehicle[i][c1], Vehicle[i][c2], -1), Vehicle[i][plate]); SetVehicleToRespawn(i); Vehicle[i][id] = VehicleID; i++; } } mysql_free_result(); printf("--- %i vehicle(s) loaded from the MySQL Database. ---", i); return 1; }
Код:
GetVehicleSQLID(vehid) { new result; for (new i = 0; i < MAX_VEHICLES; i++) { if(vehid == Vehicle[i][GameID]) { result = i; } } return result; }
My main questionm is: What is causing GetVehicleSQLID to not work?
Darren (Dazman14)