13.05.2015, 06:15
hi guys ,
my problem is everything is working fine but it's not putting the correct position of the vehicle it's just putting 0.0, 0.0, 0.0, 0.0 idk why it's happening pls someone help me out
here is the code
my problem is everything is working fine but it's not putting the correct position of the vehicle it's just putting 0.0, 0.0, 0.0, 0.0 idk why it's happening pls someone help me out
here is the code
pawn Код:
new Float:airX = -1665.9714,
Float:airY = 1210.7313,
Float:airZ = 32.9239,
Float:airA = 280.6097;
new Float:normalX = -1643.3745,
Float:normalY = 1213.0620,
Float:normalZ = 6.8095,
Float:normalA = 225.2126;
public OnSavedVehicleCreated(model, playerid, Float:x, Float:y, Float:z, Float:a)
{
for(new i = 0; i < MAX_VEH; i++)
{
if(Vehicles[i][vehStatus]) continue;
Vehicles[i][vehStatus] = true;
Vehicles[i][vehID] = mysql_insert_id();
Vehicles[i][vehModel] = model;
Vehicles[i][vehPos][0] = x;
Vehicles[i][vehPos][1] = y;
Vehicles[i][vehPos][2] = z;
Vehicles[i][vehPos][3] = a;
Vehicles[i][vehColor][0] = 1;
Vehicles[i][vehColor][1] = 1;
Vehicles[i][vehInt] = 0;
Vehicles[i][vehVW] = 0;
format(Vehicles[i][vehOwner], MAX_PLAYER_NAME, "%s", GetName(playerid));
Vehicles[i][vehLock] = true;
Vehicles[i][vehAlarm] = true;
for(new w = 0; w < 14; w++)
{
Vehicles[i][vehMods][w] = 0;
}
Vehicles[i][vehPaint] = 255;
format(Vehicles[i][vehPlate], 16, DEFAULT_NUMBER_PLATE);
createVehicle(i);
TextDrawShowForPlayer(playerid, buycarTD[0]);
TextDrawShowForPlayer(playerid, buycarTD[1]);
TextDrawShowForPlayer(playerid, buycarTD[2]);
TextDrawShowForPlayer(playerid, buycarTD[3]);
SetTimerEx("putinVehicle", 2000, false, "dd", playerid, Vehicles[i][vehicleData]);
break;
}
return 1;
}
case DIALOG_DEALERSHIP:
{
if(response)
{
for(new i = 0; i < sizeof(Dealership); i++)
{
if(Dealership[i][dealerType] == PlayerInfo[playerid][dealershipChoice])
{
new bool:success = false;
if(Dealership[i][dialogID] == listitem)
{
if(GetPlayerMoney(playerid) >= Dealership[i][dealerPrice])
{
takeMoney(playerid, Dealership[i][dealerPrice]);
success = true;
}
else
{
Server(playerid, "You didn't have enough money to buy this vehicles.");
success = false;
}
if(success)
{
new count2 = countplayerVeh(playerid);
if(count2 <= MAX_PLAYER_VEHICLES)
{
if (Dealership[i][dealerType] != AIR)
{
__createVehicle(Dealership[i][dealerModel], playerid, airX, airY, airZ, airA);
}
else
{
__createVehicle(Dealership[i][dealerModel], playerid, normalX, normalY, normalZ, normalA);
}
}
else
{
Server(playerid, "You've reached maximum car limit.");
}
}
PlayerInfo[playerid][dealershipChoice] = -1;
}
}
}
}
}
stock __createVehicle(model, playerid, Float:x, Float:y, Float:z, Float:a)
{
new query[512];
format(query, sizeof(query), "INSERT INTO `PersonalVehicles` (`Owner`, `Model`, `Veh_LocX`, `Veh_LocY`, `Veh_LocZ`, `Veh_LocA`) VALUES ('%s', '%d', '%f', '%f', '%f', '%f')", GetName(playerid), model, x, y, z, a);
mysql_function_query(connection, query, true, "OnSavedVehicleCreated", "ddffff", model, playerid, x, y, z, a);
return 1;
}
MySQL log
[11:40:57] Passing query INSERT INTO `PersonalVehicles` (`Owner`, `Model`, `Veh_LocX`, `Veh_LocY`, `Veh_LocZ`, `Veh_LocA`) VALUES ('[SvT]Goku', '571', '0.000000', '0.000000', '0.000000', '0.000000') | siii
[11:40:57] ProcessQueryThread(OnQueryFinish) - Query was successful. (INSERT INTO `PersonalVehicles` (`Owner`, `Model`, `Veh_LocX`, `Veh_LocY`, `Veh_LocZ`, `Veh_LocA`) VALUES ('[SvT]Goku', '571', '0.000000', '0.000000', '0.000000', '0.000000'))
[11:40:57] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[11:40:57] OnQueryFinish(siii) - Threaded function called.