Help not retain the second car
#1

Hello, you can help why not retain the second car

code:
http://pastebin.com/HKmTCi3z
Reply
#2

" 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;
}
Using:

Code:
#define MAX_PVEHICLES 10   
new playerCar[MAX_PLAYERS][MAX_PVEHICLES];


savePlayerCar(playerid, player[playerid][0]);
Reply
#3

Quote:
Originally Posted by TheRohlikar
View Post
" 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;
}
Using:

Code:
#define MAX_PVEHICLES 10   
new playerCar[MAX_PLAYERS][MAX_PVEHICLES];


savePlayerCar(playerid, player[playerid][0]);
Once this code is that I do it http://pastebin.com/RdB3vdeh
Reply
#4

And what do you want now from us ?
Reply
#5

Quote:
Originally Posted by TheRohlikar
View Post
" 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;
}
Using:

Code:
#define MAX_PVEHICLES 10   
new playerCar[MAX_PLAYERS][MAX_PVEHICLES];


savePlayerCar(playerid, player[playerid][0]);
Quote:
Originally Posted by TheRohlikar
View Post
And what do you want now from us ?
I want to keep a second car
Reply
#6

I edited your stock, it should work. Or fix that mistake (it's written in my post, first line)

You have same line in both stocks.

Means... you take "new veh = playerCar1[playerid]" in both stocks...
means.. everytime same veh.
Reply
#7

savePlayerCar(playerid, player[playerid][0]);

playerid where there are at variable writing
Reply
#8

Quote:
Originally Posted by TheRohlikar
View Post
I edited your stock, it should work. Or fix that mistake (it's written in my post, first line)

You have same line in both stocks.

Means... you take "new veh = playerCar1[playerid]" in both stocks...
means.. everytime same veh.
Hello, so how do we load playerCar?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)