Veh ID mysql problem
#1

Hello guys, i use dynamic vehicle system and when i create vehicle the veh_id is always 0.. Not 1,2,3 but only 0. I check in logs error or warnings but nothing is there. Here is the part of the createing the vehicle. I am using r 41-4 mysql. Here is the pic from base http://prntscr.com/j73sv1


Код:
	        if( ServerInfo[ BrojKreiranihVozila ] > MaxBrojKreiranih ) return SCM( playerid, ANTICHEAT, "[ANTICHEAT]"col_white" Nemoguce je trenutno kreirati vozilo, limit vozila na serveru je dosegnut.");
		    new idauta, Float:PozX, Float:PozY, Float:PozZ, Float:PozA, boja1, boja2;
		    GetPlayerPos( playerid, PozX, PozY, PozZ );
		    GetPlayerFacingAngle( playerid, PozA );
		    if(carspawntimer == 1)
		    {
				SendClientMessageEx( playerid, ANTICHEAT, "[ANTICHEAT]"col_white"Netko je spawnao/parkirao vozilo pre vas. Pokusajte za 3 sekunde. (Anticrash)");
				return 1;
		    }
		    if( sscanf( inputtext, "iii", idauta, boja1, boja2 ) ) return SPD( playerid, dialog_RVCREATE, DSI, D_NASLOV, "Unesite id zeljenog auta za rent vozilo, id boje1, id boje2.", D_ODABERI, D_NAZAD );
			if( idauta < 400 || idauta > 611 ) return SPD( playerid, dialog_RVCREATE, DSI, D_NASLOV, "Unesite id zeljenog auta za rent vozilo, id boje1, id boje2.", D_ODABERI, D_NAZAD );
            if( boja1 < 0 || boja1 > 255 ) return SendErrorMessage( playerid, "Prva boja ne moze biti manja od 0 ili veca od 255.");
    		if( boja2 < 0 || boja2 > 255 ) return SendErrorMessage( playerid, "Druga boja ne moze biti manja od 0 ili veca od 255.");

            sql_create_vehicle( idauta, RENTANO_VOZILO, -1, -1, -1, PozX, PozY, PozZ, PozA, boja1, boja2 );

			SendInfoMessage( playerid, "Uspesno ste kreirali rent vozilo: ID Auta: %d",idauta );
Function sql_create_vehicle:
Код:
stock sql_create_vehicle( veh_model, veh_usage, veh_org = -1, veh_job = -1, veh_fs = -1, Float:veh_pos_x, Float:veh_pos_y, Float:veh_pos_z, Float:veh_pos_a, veh_col_1, veh_col_2 ) {

	if( veh_model < 400 || veh_model > 611 ) return (true);

	new i = INVALID_VEHICLE_ID;

    i = KGEyes_CreateVehicle( veh_model, veh_pos_x, veh_pos_y, veh_pos_z+1.0, veh_pos_a, veh_col_1, veh_col_2, 300000 );

	if( i == INVALID_VEHICLE_ID ) return (true);

	VehicleInfo[ i ][ vSqlID ] = 0;
	VehicleInfo[ i ][ vOwner_sqlID ] = 0;
	VehicleInfo[ i ][ vKilometri ] = 0;
	VehicleInfo[ i ][ vMetri ] = 0;
	VehicleInfo[ i ][ vPrice ] = VehPrice[ veh_model-400 ][ 1 ];
	strmid( VehicleInfo[ i ][ vOwner ], "Drzava", 0, strlen("Drzava"), 32);
	VehicleInfo[ i ][ vLocked ] = 0;
	VehicleInfo[ i ][ vLokacijaX ] = veh_pos_x;
	VehicleInfo[ i ][ vLokacijaY ] = veh_pos_y;
	VehicleInfo[ i ][ vLokacijaZ ] = veh_pos_z;
	VehicleInfo[ i ][ vLokacijaA ] = veh_pos_a;
	VehicleInfo[ i ][ vVirtualWorld ] = 0;
	VehicleInfo[ i ][ vInterior ] = 0;
	VehicleInfo[ i ][ vUsage ] = veh_usage;
	VehicleInfo[ i ][ vJob ] = veh_job;
	VehicleInfo[ i ][ vOrganization ] = veh_org;

	if( veh_org != -1 ) VehicleInfo[ i ][ vOrganizationSQLID ] = org_info[ veh_org ][ oID ];
	else VehicleInfo[ i ][ vOrganizationSQLID ] = 0;

	VehicleInfo[ i ][ vFuelStation ] = veh_fs;
	VehicleInfo[ i ][ vColor1 ] = veh_col_1;
    VehicleInfo[ i ][ vColor2 ] = veh_col_2;
    VehicleInfo[ i ][ vModel ] = veh_model;
    VehicleInfo[ i ][ vReg ] = 1;
    VehicleInfo[ i ][ vRegVreme ] = 0;
	VehicleInfo[ i ][ vTeh ] = 1;
    VehicleInfo[ i ][ vGPS ] = 0;
    VehicleInfo[ i ][ vOsiguranje ] = 5;
    VehicleInfo[ i ][ v_owner_id ] = -1;

    if( veh_usage == PRIVATNO_VOZILO ) {
    	VehicleInfo[ i ][ vLock ] = 0;
    	VehicleInfo[ i ][ vAlarm ] = 0;
    	VehicleInfo[ i ][ vImobilizator ] = 0;
	}
    else {
    	VehicleInfo[ i ][ vLock ] = 5;
    	VehicleInfo[ i ][ vAlarm ] = 4;
    	VehicleInfo[ i ][ vImobilizator ] = 5;
	}

	VehicleInfo[ i ][ vNeon ] = 0;
    VehicleInfo[ i ][ vTuned ] = 0;
    VehicleInfo[ i ][ vSpoiler ] = 0;
    VehicleInfo[ i ][ vHood ] = 0;
    VehicleInfo[ i ][ vRoof ] = 0;
    VehicleInfo[ i ][ vSkirt ] = 0;
    VehicleInfo[ i ][ vLamps ] = 0;
    VehicleInfo[ i ][ vNitro ] = 0;
    VehicleInfo[ i ][ vExhaust ] = 0;
    VehicleInfo[ i ][ vWheels ] = 0;
    VehicleInfo[ i ][ vStereo ] = 0;
    VehicleInfo[ i ][ vHydraulics ] = 0;
    VehicleInfo[ i ][ vFrontBumper ] = 0;
    VehicleInfo[ i ][ vRearBumper ] = 0;
    VehicleInfo[ i ][ vVents ] = 0;
    VehicleInfo[ i ][ vPaintJob ] = 255;
    VehicleInfo[ i ][ vMaterijali ] = 0;
    VehicleInfo[ i ][ vDrugAmmount ][ 0 ] = 0; VehicleInfo[ i ][ vDrugAmmount ][ 1 ] = 0; VehicleInfo[ i ][ vDrugAmmount ][ 2 ] = 0; VehicleInfo[ i ][ vDrugAmmount ][ 3 ] = 0; VehicleInfo[ i ][ vDrugAmmount ][ 4 ] = 0; VehicleInfo[ i ][ vDrugAmmount ][ 5 ] = 0;
	VehicleInfo[ i ][ vMelee ] = 0; VehicleInfo[ i ][ vWeap1 ] = 0; VehicleInfo[ i ][ vAmmo1 ] = 0; VehicleInfo[ i ][ vWeap2 ] = 0; VehicleInfo[ i ][ vAmmo2 ] = 0;
	VehicleInfo[ i ][ vGajbica ][ 0 ] = -1; VehicleInfo[ i ][ vGajbica ][ 1 ] = -1; VehicleInfo[ i ][ vGajbica ][ 2 ] = -1; VehicleInfo[ i ][ vGajbica ][ 3 ] = -1; VehicleInfo[ i ][ vGajbica ][ 4 ] = -1;
    VehicleInfo[ i ][ vGajbicaAmmount ][ 0 ] = 0; VehicleInfo[ i ][ vGajbicaAmmount ][ 1 ] = 0; VehicleInfo[ i ][ vGajbicaAmmount ][ 2 ] = 0; VehicleInfo[ i ][ vGajbicaAmmount ][ 3 ] = 0; VehicleInfo[ i ][ vGajbicaAmmount ][ 4 ] = 0;

    LinkVehicleToInterior( i, VehicleInfo[ i ][ vInterior ] );
    SetVehicleVirtualWorld( i, VehicleInfo[ i ][ vVirtualWorld ] );

    VehicleInfo[ i ][ vFuel ] = getAmountFuel( i ); vCanDrive[ i ] = 1; Fuel[ i ] = getAmountFuel( i );
	UnLockCar( i ); ResetVehicleStatistics( i );

    SetVehicleLabels( i );

    if( veh_usage == PRIVATNO_VOZILO ) SetVehicleNumberPlate( i, "NEMA" );
	else SetTablice( i );

	carspawntimer = 1;
	SetTimer("AntiSpawnCrash", 3000, 0);

	SetVehicleParamsEx( i, 0, 0, 0, VehicleInfo[ i ][ vLocked ], 0, 0, 0 );
	if( IsVehicleBajs( i ) ) {
		SetVehicleParamsEx( i, 1, 0, 0, VehicleInfo[ i ][ vLocked ], 0, 0, 0 );
	}

	if( Diesel( i ) ) VehicleInfo[ i ][ vFuelType ] = 1;
	else if( Gasoline( i ) ) VehicleInfo[ i ][ vFuelType ] = 2;
	else if( GasOil( i ) ) VehicleInfo[ i ][ vFuelType ] = 3;


    #if ZIMSKI_MOD == 1
	if( veh_usage == POSLOVNO_VOZILO && veh_job == POSAO_KOMUNALAC && veh_model == 455 ) {

		SnowObjects[ i ] = true;

		SnowObject1[ i ] = CreateDynamicObject( 19601, 0, 0, 1500, 0, 0, 0 );
		AttachDynamicObjectToVehicle( SnowObject1[ i ], i, 0.000000, 4.200001, -1.049999, 13.500000, 0.000000, 180.000 );

		SnowObject2[ i ] = CreateDynamicObject( 18646, 0, 0, 1500, 0, 0, 0 );
		AttachDynamicObjectToVehicle( SnowObject2[ i ], i, 0.749999, 1.575000, 1.725000, 0.000000, 0.000000, 0.000000 );

	}
	#endif

    new query[ 512 ];
    mysql_format( _dbConnector, query, sizeof( query ), "INSERT INTO `vehicles` (v_price, v_pos_x, v_pos_y, v_pos_z, v_pos_a, v_virtualw, v_interior, v_usage, v_organization, v_job, v_fuel_station, v_color_1, v_color_2, v_model) \
  		VALUES( '%d', '%f', '%f', '%f', '%f', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d' )",

	    VehicleInfo[ i ][ vPrice ], VehicleInfo[ i ][ vLokacijaX ], VehicleInfo[ i ][ vLokacijaY ], VehicleInfo[ i ][ vLokacijaZ ],
		VehicleInfo[ i ][ vLokacijaA ], VehicleInfo[ i ][ vVirtualWorld ], VehicleInfo[ i ][ vInterior ],
		VehicleInfo[ i ][ vUsage ], VehicleInfo[ i ][ vOrganizationSQLID ], VehicleInfo[ i ][ vJob ], VehicleInfo[ i ][ vFuelStation ],
		VehicleInfo[ i ][ vColor1 ], VehicleInfo[ i ][ vColor2 ], VehicleInfo[ i ][ vModel ] );

	mysql_pquery( _dbConnector, query, "OnVehicleCreate", "i", i);

    return i;
}

forward OnVehicleCreate( vehicleid );
public OnVehicleCreate( vehicleid ){

	VehicleInfo[ vehicleid ][ vSqlID ] = cache_insert_id();
	return true;
}
Reply


Messages In This Thread
Veh ID mysql problem - by expressoboy123 - 18.04.2018, 21:58
Re: Veh ID mysql problem - by arakuta - 19.04.2018, 11:23
Re: Veh ID mysql problem - by jasperschellekens - 19.04.2018, 12:42
Re: Veh ID mysql problem - by expressoboy123 - 19.04.2018, 14:45
Re: Veh ID mysql problem - by UFF - 19.04.2018, 15:01
Re: Veh ID mysql problem - by jasperschellekens - 19.04.2018, 15:18
Re: Veh ID mysql problem - by UFF - 19.04.2018, 15:31
Re: Veh ID mysql problem - by expressoboy123 - 20.04.2018, 22:15

Forum Jump:


Users browsing this thread: 1 Guest(s)