Este comandito
#1

Buenas, estuve intentando hacer este comando pero no me da -_-" al momento de usarlo me dice que no puedo tener mбs vehнculos mientras que no tengo ninguno.
pawn Код:
CMD:comprarveh(playerid, params[])
{
    foreach(aAutos,i)
    {
        new texto[128], veh;
        veh = GetPlayerVehicleID(playerid);
        if(InformacionA[i][aComprado] == true) return SendClientMessage(playerid, -1, "El vehнculo no se encuentra comprado");
        if(GetPlayerMoney(playerid) < InformacionA[i][aPrecio]) return SendClientMessage(playerid, -1, "No tines suficiente dinero");
        if(Informacion[playerid][pLlaves1] == 999999)
        {
            Informacion[playerid][pLlaves1] = veh;
            InformacionA[i][aComprado] = true;
            format(texto, sizeof(texto), "{FFFFFF}Felicidades, compraste el vehнculo por {00FF40}%i",InformacionA[i][aPrecio]);
            SendClientMessage(playerid, -1, texto);
            GivePlayerMoney(playerid, -InformacionA[i][aPrecio]);
        }
        else if(Informacion[playerid][pLlaves2] == 999999)
        {
            Informacion[playerid][pLlaves2] = veh;
            GivePlayerMoney(playerid, -InformacionA[i][aPrecio]);
            InformacionA[i][aComprado] = true;
            format(texto, sizeof(texto), "{FFFFFF}Felicidades, compraste el vehнculo por {00FF40}%i",InformacionA[i][aPrecio]);
            SendClientMessage(playerid, -1, texto);
        }
        else
        {
            SendClientMessage(playerid, -1, "No puedes tener mбs vehнculos");
        }
    }
    return 1;
}
De antemano muchas gracias.
Reply
#2

pLlaves por defecto їestб en 999999?
Reply
#3

Sн, son seteadas en 999999 al registrarte.
Reply
#4

Prueba con un loop normal en ves de foreach. Creo que estas usando el foreach incorrectamente en este caso.
Reply
#5

pawn Код:
CMD:comprarveh(playerid, params[])
{
    foreach(aAutos,i)
    {
        new texto[128], veh;
        veh = GetPlayerVehicleID(playerid);
        if(InformacionA[i][aComprado] == false) return SendClientMessage(playerid, -1, "El vehнculo no se encuentra comprado");
        if(GetPlayerMoney(playerid) < InformacionA[i][aPrecio]) return SendClientMessage(playerid, -1, "No tines suficiente dinero");
        if(Informacion[playerid][pLlaves1] == 999999)
        {
            Informacion[playerid][pLlaves1] = veh;
            InformacionA[i][aComprado] = true;
            format(texto, sizeof(texto), "{FFFFFF}Felicidades, compraste el vehнculo por {00FF40}%i",InformacionA[i][aPrecio]);
            SendClientMessage(playerid, -1, texto);
            GivePlayerMoney(playerid, -InformacionA[i][aPrecio]);
        }
        else if(Informacion[playerid][pLlaves2] == 999999)
        {
            Informacion[playerid][pLlaves2] = veh;
            GivePlayerMoney(playerid, -InformacionA[i][aPrecio]);
            InformacionA[i][aComprado] = true;
            format(texto, sizeof(texto), "{FFFFFF}Felicidades, compraste el vehнculo por {00FF40}%i",InformacionA[i][aPrecio]);
            SendClientMessage(playerid, -1, texto);
        }
        else
        {
            SendClientMessage(playerid, -1, "No puedes tener mбs vehнculos");
        }
    }
    return 1;
}
Probб asн, no sй, no estoy seguro.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)