30.11.2016, 11:16
Quote:
" new veh = playerCar1 [ playerid ] ;"
in both stocks btw. easier and better: Code:
stock savePlayerCar( playerid, veh) { new query [ 1050] , Float:posi [ 4 ] , Float:hp , Engine , Lights , Alarm, Doors, Bonnet, Boot, Objective; if ( veh != -1 ) { GetVehiclePos ( veh , posi [ 0 ] , posi [ 1 ] , posi [ 2 ] ) ; GetVehicleZAngle ( veh , posi [ 3 ] ) ; GetVehicleParamsEx ( veh , Engine , Lights , Alarm , Doors , Bonnet , Boot , Objective ) ; SetVehicleParamsEx ( veh , Engine , Lights , Alarm , Doors , Bonnet , Boot , Objective ) ; GetVehicleHealth ( veh , hp ) ; format ( query , sizeof ( query ) , "UPDATE cars SET \ posX = '%f',\ posY = '%f',\ posZ = '%f',\ posA = '%f',\ lastPosX = '%f',\ lastPosY = '%f',\ lastPosZ = '%f',\ lastPosA = '%f',\ sprogo = %d,\ locked = %d,\ numbers = '%s',\ engine = %d,\ lights = %d,\ hp = '%f',\ rida = '%f',\ gas = %d,\ paintjob = %d,\ color1 = %d,\ color2 = %d, \ vZole = '%d',\ vLSD = '%d',\ vAmfa = '%d',\ akumas = '%d',\ akumohp = '%f'\ WHERE owner = '%s'" , posi [ 0 ] , posi [ 1 ] , posi [ 2 ] , posi [ 3 ] , posi [ 0 ] , posi [ 1 ] , posi [ 2 ] , posi [ 3 ] , vehicleDB [ veh ] [ vSprogo ] , vehicleDB [ veh ] [ vLocked ] , vehicleDB [ veh ] [ numeriai ] , Engine , Lights , hp , vehicleDB [ veh ] [ Rida ] , vehicleDB [ veh ] [ gas ] , vehicleDB [ veh ] [ vPaintjob ] , vehicleDB [ veh ] [ vColor ] [ 0 ], vehicleDB [ veh ] [ vColor ] [ 1 ] ,vehicleDB[veh][vZole],vehicleDB[veh][vLSD],vehicleDB[veh][vAmfa],vehicleDB[veh][akumas],vehicleDB[veh][akumohp], GetPlayerNameEx ( playerid ) ) ; mysql_query ( query ) ; for ( new t = 0; t < 13; t ++ ) { format ( query , sizeof ( query ) , "UPDATE cars SET tune%d = %d WHERE owner = '%s'" , t , vehicleDB [ veh ] [ vTune ] [ t ] , GetPlayerNameEx ( playerid ) ) ; mysql_query ( query ) ; } DestroyVehicle ( veh ) ; } return 1; } Code:
#define MAX_PVEHICLES 10 new playerCar[MAX_PLAYERS][MAX_PVEHICLES]; savePlayerCar(playerid, player[playerid][0]); |