InformacionVehiculo_[TotalVehiculos][vParking][0] = InformacionVehiculo_[VehiculoID][vSpawn][0]; InformacionVehiculo_[TotalVehiculos][vParking][1] = InformacionVehiculo_[VehiculoID][vSpawn][1]; InformacionVehiculo_[TotalVehiculos][vParking][2] = InformacionVehiculo_[VehiculoID][vSpawn][2]; InformacionVehiculo_[TotalVehiculos][vPAngle] = InformacionVehiculo_[VehiculoID][vSAngle];
CMD:comprar(playerid, params[])
{
if(strfind(params[0], "vehiculo", true) != -1)
{
if(IsPlayerInAnyVehicle(playerid))
{
new EspacioLibre, VehiculoID = GetPlayerVehicleID(playerid);
if(InformacionVehiculo_[VehiculoID][vEstado] == 0) return SendErrorMessage(playerid, "Este vehнculo no estб a la venta.");
if(GetPlayerCash(playerid) < InformacionVehiculo_[playerid][vPrecio]) return SendErrorMessage(playerid, "No tienes el dinero necesario para comprar este vehнculo.");
if(InformacionJugador_[playerid][pPremium] == 0)
{
for(new l = 0; l < 4; l ++)
{
if(InformacionJugador_[playerid][pLlavesCoches][l] == 0){EspacioLibre = 1; break;}
}
if(EspacioLibre == 0){SendErrorMessage(playerid, "Ya tienes todas las llaves ocupadas siendo usuario Normal."); return 1;}
}
if(InformacionJugador_[playerid][pPremium] == 1)
{
for(new l = 0; l < 8; l ++)
{
if(InformacionJugador_[playerid][pLlavesCoches][l] == 0){EspacioLibre = 1; break;}
}
if(EspacioLibre == 0){SendErrorMessage(playerid, "Ya tienes todas las llaves ocupadas siendo usuario Premium."); return 1;}
}
++TotalVehiculos;
InformacionVehiculo_[TotalVehiculos][vModelo] = InformacionVehiculo_[VehiculoID][vModelo];
InformacionVehiculo_[TotalVehiculos][vColor][0] = 1;
InformacionVehiculo_[TotalVehiculos][vColor][1] = 1;
InformacionVehiculo_[TotalVehiculos][vMotor] = 0;
InformacionVehiculo_[TotalVehiculos][vPrecio] = InformacionVehiculo_[VehiculoID][vPrecio];
InformacionVehiculo_[TotalVehiculos][vInterior] = GetPlayerInterior(playerid);
InformacionVehiculo_[TotalVehiculos][vVirtualWorld] = GetPlayerVirtualWorld(playerid);
InformacionVehiculo_[TotalVehiculos][vParking][0] = InformacionVehiculo_[VehiculoID][vSpawn][0];
InformacionVehiculo_[TotalVehiculos][vParking][1] = InformacionVehiculo_[VehiculoID][vSpawn][1];
InformacionVehiculo_[TotalVehiculos][vParking][2] = InformacionVehiculo_[VehiculoID][vSpawn][2];
InformacionVehiculo_[TotalVehiculos][vPAngle] = InformacionVehiculo_[VehiculoID][vSAngle];
InformacionVehiculo_[TotalVehiculos][vSpawn][0] = -1;
InformacionVehiculo_[TotalVehiculos][vSpawn][1] = -1;
InformacionVehiculo_[TotalVehiculos][vSpawn][2] = -1;
InformacionVehiculo_[TotalVehiculos][vSAngle] = -1;
InformacionVehiculo_[TotalVehiculos][vEstado] = 0;
InformacionVehiculo_[TotalVehiculos][vKilometros] = 0;
InformacionVehiculo_[TotalVehiculos][vTipo] = InformacionVehiculo_[VehiculoID][vTipo];
InformacionVehiculo_[TotalVehiculos][vCantidad] = -1;
InformacionVehiculo_[TotalVehiculos][vSQLID] = TotalVehiculos;
for(new l; l < 8; l ++)
{
if(InformacionJugador_[playerid][pLlavesCoches][l] == 0)
{
InformacionJugador_[playerid][pLlavesCoches][l] = InformacionVehiculo_[TotalVehiculos][vSQLID];
break;
}
}
new random1 = random(99), random2 = random(99), matricula[10];
format(matricula, sizeof(matricula), "EV %d%d", random1, random2);
format(InformacionVehiculo_[TotalVehiculos][vPropietario], 25, "%s", GetPlayerNameEx(playerid));
format(InformacionVehiculo_[TotalVehiculos][vMatricula], 10, "%s", matricula);
new Query[200];
mysql_format(MySQL, Query, sizeof Query, "INSERT INTO vehiculos (vSQLID, vPosX, vPosY, vPosZ, vMatricula, vPropietario) VALUES ('%d', '%f', '%f', '%f', '%e', '%e')", InformacionVehiculo_[TotalVehiculos][vSQLID], InformacionVehiculo_[TotalVehiculos][vParking][0],
InformacionVehiculo_[TotalVehiculos][vParking][1], InformacionVehiculo_[TotalVehiculos][vParking][2], InformacionVehiculo_[TotalVehiculos][vMatricula], InformacionVehiculo_[TotalVehiculos][vMatricula]);
mysql_tquery(MySQL, Query);
new CrearVehiculo;
CrearVehiculo = CreateVehicle(InformacionVehiculo_[TotalVehiculos][vModelo], InformacionVehiculo_[TotalVehiculos][vSpawn][0], InformacionVehiculo_[TotalVehiculos][vSpawn][1], InformacionVehiculo_[TotalVehiculos][vSpawn][2], InformacionVehiculo_[TotalVehiculos][vSAngle],
InformacionVehiculo_[TotalVehiculos][vColor][0], InformacionVehiculo_[TotalVehiculos][vColor][1], 600000);
LinkVehicleToInterior(CrearVehiculo, InformacionVehiculo_[TotalVehiculos][vInterior]), SetVehicleVirtualWorld(CrearVehiculo, InformacionVehiculo_[TotalVehiculos][vVirtualWorld]);
SetVehicleNumberPlate(CrearVehiculo, InformacionVehiculo_[TotalVehiculos][vMatricula]);
GetVehicleParamsEx(CrearVehiculo, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(CrearVehiculo, 0, 0, alarm, doors, bonnet, boot, objective), SetVehicleHealthEx(CrearVehiculo, 1000);
PutPlayerInVehicle(playerid, CrearVehiculo, 0), QuitarDineroPlayer_(playerid, InformacionVehiculo_[TotalVehiculos][vPrecio]);
new string[100];
SendClientMessage(playerid, COLOR_BLANCO, "-------------------------------------------------------------------------------------------------------------------");
SendClientMessage(playerid, COLOR_GRIS_2, "* ЎFelicidades!"#CBLANCO" compraste un vehнculo, para obtener mбs informaciуn usa el comando "#CAMARILLO"/ayuda.");
if(InformacionVehiculo_[TotalVehiculos][vTipo] == 0)
{
format(string, sizeof(string), "* El vehнculo tiene la patente "#CAZUL"%s"#CBLANCO" y tiene un encendido "#CROJO_2"*Malo*.", InformacionVehiculo_[TotalVehiculos][vMatricula]);
SendClientMessage(playerid, COLOR_BLANCO, string);
}
if(InformacionVehiculo_[TotalVehiculos][vTipo] == 1)
{
format(string, sizeof(string), "* El vehнculo tiene la patente "#CAZUL"%s"#CBLANCO" y tiene un encendido "#CVERDE_CLARO"Excelente.", InformacionVehiculo_[TotalVehiculos][vMatricula]);
SendClientMessage(playerid, COLOR_BLANCO, string);
}
SendClientMessage(playerid, COLOR_BLANCO, "* El vehнculo viene por defecto con una "#CCELESTE"Baterнa Cyclon 6V"#CBLANCO" de calidad "#CROJO"*Baja*.");
SendClientMessage(playerid, COLOR_ROJO_2, "* Importante: ЎNo dejes tu vehнculo mal estacionado o podrб ser llevado al deposito!");
SendClientMessage(playerid, COLOR_BLANCO, "-------------------------------------------------------------------------------------------------------------------");
ActualizarVehiculo(TotalVehiculos), ActualizarJugador(playerid);
}
}
return 1;
}
InformacionVehiculo_[TotalVehiculos][vSpawn][0] = -1; InformacionVehiculo_[TotalVehiculos][vSpawn][1] = -1; InformacionVehiculo_[TotalVehiculos][vSpawn][2] = -1;
new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); InformacionVehiculo_[TotalVehiculos][vSpawn][0] = x; InformacionVehiculo_[TotalVehiculos][vSpawn][1] = y + 2.0; InformacionVehiculo_[TotalVehiculos][vSpawn][2] = z;
|
Estбs asignando las variables que dices a -1;
Код:
InformacionVehiculo_[TotalVehiculos][vSpawn][0] = -1; InformacionVehiculo_[TotalVehiculos][vSpawn][1] = -1; InformacionVehiculo_[TotalVehiculos][vSpawn][2] = -1; Код:
new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); InformacionVehiculo_[TotalVehiculos][vSpawn][0] = x; InformacionVehiculo_[TotalVehiculos][vSpawn][1] = y + 2.0; InformacionVehiculo_[TotalVehiculos][vSpawn][2] = z; |