SA-MP Forums Archive
Seems weird - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Seems weird (/showthread.php?tid=529403)



Seems weird - Drago987 - 02.08.2014

<removed>


Re: Seems weird - dirigent00 - 02.08.2014

After the bracket of the last one else, add return 1;
Try this:

Код:
forward BreakVehicleLock(playerid, vehicleid, ownerid, carslot, family);
public BreakVehicleLock(playerid, vehicleid, ownerid, carslot, family)
{
    new rand = random(7), string[128];
    TogglePlayerControllable(playerid, 1);
    if(rand == 1 || rand == 2) // Successful
    {
        if(IsAMPBike(PlayerVehicleInfo[playerid][vehicleid][pvId]) || IsABike(PlayerVehicleInfo[playerid][vehicleid][pvBId]))
        {
            format(string, sizeof(string), "* %s successfully breaks the chain lock, unwrapping the chain off the back tire.", GetPlayerNameEx(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

            //PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
            //PlayerVehicleInfo[playerid][d][pvBLocked] = 1;
            new engine,lights,alarm,doors,bonnet,boot,objective;
            GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vehicleid,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
            SetTimerEx("DisableVehicleAlarm", 30000, 0, "d",  vehicleid);
            return 0;
        }
        format(string, sizeof(string), "* %s successfully breaks the lock on the door, opening it.", GetPlayerNameEx(playerid));
        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

        new engine,lights,alarm,doors,bonnet,boot,objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vehicleid,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
        SetTimerEx("DisableVehicleAlarm", 30000, 0, "d",  vehicleid);

        if(family == 0)
        {
            PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
            PlayerVehicleInfo[ownerid][carslot][pvLocked] = 1;
            UnLockPlayerVehicle(ownerid, PlayerVehicleInfo[ownerid][carslot][pvId], PlayerVehicleInfo[ownerid][carslot][pvLock]);
        }
        else
        {
            PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
            FamilyVehicleInfo[ownerid][carslot][fvLocked] = 1;
            UnLockGangVehicle(ownerid, FamilyVehicleInfo[ownerid][carslot][fvId], FamilyVehicleInfo[ownerid][carslot][fvLock]);
        }
    }
    else
    {
        format(string, sizeof(string), "* %s is unable to break the vehicle lock.", GetPlayerNameEx(playerid));
        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
return 1;
}



Re: Seems weird - Drago987 - 02.08.2014

Quote:
Originally Posted by dirigent00
Посмотреть сообщение
After the bracket of the last one else, add return 1;
Try this:

Код:
forward BreakVehicleLock(playerid, vehicleid, ownerid, carslot, family);
public BreakVehicleLock(playerid, vehicleid, ownerid, carslot, family)
{
    new rand = random(7), string[128];
    TogglePlayerControllable(playerid, 1);
    if(rand == 1 || rand == 2) // Successful
    {
        if(IsAMPBike(PlayerVehicleInfo[playerid][vehicleid][pvId]) || IsABike(PlayerVehicleInfo[playerid][vehicleid][pvBId]))
        {
            format(string, sizeof(string), "* %s successfully breaks the chain lock, unwrapping the chain off the back tire.", GetPlayerNameEx(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

            //PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
            //PlayerVehicleInfo[playerid][d][pvBLocked] = 1;
            new engine,lights,alarm,doors,bonnet,boot,objective;
            GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vehicleid,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
            SetTimerEx("DisableVehicleAlarm", 30000, 0, "d",  vehicleid);
            return 0;
        }
        format(string, sizeof(string), "* %s successfully breaks the lock on the door, opening it.", GetPlayerNameEx(playerid));
        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

        new engine,lights,alarm,doors,bonnet,boot,objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vehicleid,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
        SetTimerEx("DisableVehicleAlarm", 30000, 0, "d",  vehicleid);

        if(family == 0)
        {
            PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
            PlayerVehicleInfo[ownerid][carslot][pvLocked] = 1;
            UnLockPlayerVehicle(ownerid, PlayerVehicleInfo[ownerid][carslot][pvId], PlayerVehicleInfo[ownerid][carslot][pvLock]);
        }
        else
        {
            PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
            FamilyVehicleInfo[ownerid][carslot][fvLocked] = 1;
            UnLockGangVehicle(ownerid, FamilyVehicleInfo[ownerid][carslot][fvId], FamilyVehicleInfo[ownerid][carslot][fvLock]);
        }
    }
    else
    {
        format(string, sizeof(string), "* %s is unable to break the vehicle lock.", GetPlayerNameEx(playerid));
        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
return 1;
}
How dumb I am?
Thanks mate, it was fixed

++ REP'ed