Cargar carros
#1

Buenas,

Aun sigo trabajando en el sistema de vehiculos mysql, logre arreglar el guardado. Pero ahora les vengo a pedir ideas sobre como podria cargar los vehiculos de la Base de datos. Me vino a la mente Crear un stock y llamarlo cuando el player se conecte. Lo tengo asi

pawn Код:
stock LoadPlayerCars(playerid)
{
    new query[120];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    mysql_format(mysql,query,sizeof(query),"SELECT * FROM `cars` WHERE `Owner` = '%s'",name);
    printf("%s",query);
    mysql_tquery(mysql,query);
    CarInfo[carid][cID] = cache_get_field_content_int(0, "ID");
    CarInfo[carid][cOwner] = cache_get_field_content(0, "Owner", CarInfo[carid][cOwner]);
    CarInfo[carid][cModel] = cache_get_field_content_int(0, "Model");
    CarInfo[carid][cColor1] = cache_get_field_content_int(0, "VehicleColor1");
    CarInfo[carid][cColor2] = cache_get_field_content_int(0, "VehicleColor2");
    CarInfo[carid][cXPos] = cache_get_field_content_float(0, "XCoord");
    CarInfo[carid][cYPos] = cache_get_field_content_float(0, "YCoord");
    CarInfo[carid][cZPos] = cache_get_field_content_float(0, "ZCoord");
    CarInfo[carid][cPlate] = cache_get_field_content(0, "VehiclePlate", CarInfo[carid][cPlate]);
}
Pero como veran la stock solo tiene el parametro Playerid, entonces obviamente me da errores con el carid.
Pense en hacer un loop sobre los carros del playerid, y poner el valor del loop en donde esta carid. Pero no se si el loop lo haria en la stock o en la CallBack OnPlayerConnect.

Saludos!
Reply


Messages In This Thread
Cargar carros - by [CG]Milito - 01.12.2014, 02:28
Respuesta: Cargar carros - by Zume - 01.12.2014, 03:08
Respuesta: Cargar carros - by jotajeda - 01.12.2014, 14:26
Respuesta: Cargar carros - by Zume - 01.12.2014, 14:33
Respuesta: Cargar carros - by jotajeda - 01.12.2014, 15:07
Respuesta: Cargar carros - by [CG]Milito - 01.12.2014, 15:45
Respuesta: Cargar carros - by [CG]Milito - 01.12.2014, 16:26
Respuesta: Cargar carros - by jotajeda - 01.12.2014, 16:31
Respuesta: Cargar carros - by [CG]Milito - 01.12.2014, 16:35
Respuesta: Cargar carros - by jotajeda - 01.12.2014, 16:39

Forum Jump:


Users browsing this thread: 1 Guest(s)