17.05.2015, 19:57
Buenas, editй el sistema de vehнculos que publicу Zume en un tutorial de hace un tiempito, y ahora cuando yo entro a un vehнculo que estб en venta, no funciona, me reconoce que el vehнculo ya estб comprado.
Desde ya, muchas gracias.
PHP код:
CMD:crearauto(playerid, params[])
{
if(Informacion[playerid][pAdmin] < 7) return MensajeError(playerid, "El comando que ingresaste no existe.");
if(sscanf(params,"iis[32]",params[0],params[1],params[2])) return MensajeInfo(playerid, "/CrearAuto [Modelo ID] [Precio] [Nombre del modelo]");
if(LastVehicle == 500) return MensajeError(playerid, "No se pueden crear mбs vehнculos.");
if(params[0] < 400 || params[0] > 611) return MensajeError(playerid, "El modelo del vehнculo debe estar por encima del 400 y debajo del 611.");
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
CreateVehicleEx(params[0], params[1], params[2], X, Y, Z, A, 1, 1);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
switch(newstate)
{
case PLAYER_STATE_DRIVER:
{
new vehicleid = GetPlayerVehicleID(playerid);
if(InformacionA[vehicleid][V_AVENTA] == true)
{
new asd[128];
format(asd, sizeof(asd), "{FF0000}Modelo: {FFFFFF}%s\n{FF0000}Precio: {FFFFFF}$%i",InformacionA[vehicleid][V_NAME],InformacionA[vehicleid][V_PRECIO]);
ShowPlayerDialog(playerid, DIALOG_COMPRAR_VEH, DIALOG_STYLE_MSGBOX, "Vehнculo en venta", asd, "Comprar", "Cancelar");
}
else if(Motor[vehicleid] == true)
{
MensajeInfo(playerid, "El vehнculo se encuentra encendido, recuerda que puedes apagarlo utilizando /motor.");
}
else
{
MensajeInfo(playerid, "El vehнculo se encuentra apagado, si deseas encenderlo utiliza /motor.");
}
}
}
return 1;
}
stock CreateVehicleEx(_MODEL, _PRECIO, _NOMBRE[], Float:_X, Float:_Y, Float:_Z, Float:_A, _COLOR_TWO, _COLOR_ONE)
{
new str[128];
for(new i; i <= MAX_DVEHICLES; i++) if(!InformacionA[i][V_EXIST])
{
InformacionA[i][V_EXIST] = true;
InformacionA[i][V_MODEL] = _MODEL;
format(InformacionA[i][V_NAME],32,"%s",_NOMBRE);
InformacionA[i][V_POS][0] = _X;
InformacionA[i][V_POS][1] = _Y;
InformacionA[i][V_POS][2] = _Z;
InformacionA[i][V_POS][3] = _A;
InformacionA[i][V_PRECIO] = _PRECIO;
InformacionA[i][V_COLOR][0] = _COLOR_ONE;
InformacionA[i][V_COLOR][1] = _COLOR_TWO;
InformacionA[i][V_AVENTA] = true; // Acб estoy seteando la variable en true...
InformacionA[i][V_ORIGINAL] = CreateVehicle(_MODEL, _X, _Y, _Z, _A, _COLOR_ONE, _COLOR_TWO, -1);
InformacionA[i][V_ID] = ++LastVehicle;
format(str, sizeof(str), DIR_COCHES"/%i.ini", LastVehicle);
CreateFile(str);
_SaveVehicleID(i);
return i;
}
return -1;
}