No entiendo
#1

Le he dado mil vueltas a este comando, he cambiado varias veces cosas, pero el vehiculo lo cierro, pero cualquiera puede entrar, osea como si no cerrara.

pawn Код:
CMD:cerrar(playerid, params[])
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    new vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    new Float: x, Float: y, Float: z;
    if(Info[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
    {
        new ownerid = Info[playerid][pVehicleKeysFrom];
        if(IsPlayerConnected(ownerid))
        {
            new d = Info[playerid][pVehicleKeys];
            if(PlayerVehicleInfo[ownerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], x, y, z);
            if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
            {
                if(PlayerVehicleInfo[ownerid][d][pvLock] > 0)
                {
                    if(PlayerVehicleInfo[ownerid][d][pvLocked] == 0)
                    {
                        new string[64];
                        format(string, sizeof(string), "* %s trabу las puertas de su vehнculo.", GetPlayerNameEx(playerid));
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        PlayerPlaySoundEx(1145, x, y, z);
                        SetVehicleParamsEx(vehicleid, engine, lights, alarm, 1, bonnet, boot, objective);
                        PlayerVehicleInfo[ownerid][d][pvLocked] = 1;
                        LockPlayerVehicle(ownerid, PlayerVehicleInfo[ownerid][d][pvId], PlayerVehicleInfo[ownerid][d][pvLock]);
                        return 1;
                    }
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_GREY, " Usted no tiene un sistema de bloqueo instalado en el vehнculo.");
                    return 1;
                }
            }
        }
    }
    for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
    {
        if(PlayerVehicleInfo[playerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
        if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
        {
            if(PlayerVehicleInfo[playerid][d][pvLock] > 0 && PlayerVehicleInfo[playerid][d][pvLocked] == 0)
            {
                new string[64];
                format(string, sizeof(string), "* %s trabу las puertas de su vehнculo.", GetPlayerNameEx(playerid));
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                PlayerPlaySoundEx(1145, x, y, z);
                PlayerVehicleInfo[playerid][d][pvLocked] = 1;
                SetVehicleParamsEx(vehicleid, engine, lights, alarm, 1, bonnet, boot, objective);
                LockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId], PlayerVehicleInfo[playerid][d][pvLock]);
                return 1;
            }
            SendClientMessageEx(playerid, COLOR_GREY, " Usted no tiene un sistema de bloqueo instalado en el vehнculo.");
            return 1;
        }
    }
    SendClientMessageEx(playerid, COLOR_GREY, " Debes de estar cerca de un coche tuyo.");
    return 1;
}
Reply
#2

Estбs seteando los parбmetros de "vehicleid" segъn tu funciуn "vehicleid" hace referencia al ID del vehнculo en el cual el jugador estб montado. Si estбs cerrando el coche fuera de йl, debes colocar en 'SetVehicleParamsEx' la variable en la cual detectas ese coche cercano.
Reply
#3

Ahi esta en setvehicleparamsex
Reply
#4

revivo
Reply
#5

No entiendes. en SetVehicleParamsEx estбs comprobando el "vehicleid" es decir, el ID del vehнculo el cual el jugador estб montado y si el mismo no estб montado en ningъn vehнculo entonces no toma ninguna ID para llevar a cabo la funciуn. Debes usar funciуn que detecte todos los vehнculos y si estбs cerca de X coche, que tome la ID de ese, y ejecute la funciуn.
Reply
#6

buf no entiendo
Reply
#7

Quote:
Originally Posted by Metzone
Посмотреть сообщение
buf no entiendo
Bucles caballero bucles.
Reply
#8

aver, cuando pongo /cerrar, me dice que el auto se cerro, peo al dar enter, se sube, como si no hubiera cerrado
Reply
#9

Leй bien.

en "vehicleid" estбs almacenando la variable del coche en el que el jugador estб MONTADO, pero nadie estб montado en ese coche, porque el comando lo estбs ejecutando fuera de йl.

Entonces, debes hacer un bucle que compruebe todos los coches, y si estбs cerca de UN vehнculo (comprobado con un bucle) entonces la funciуn se ejecutarнa. Pero harнa efecto, si a la funciуn "SetVehicleParamsEx" le colocas la ID del coche que se detectу cerca.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)