SA-MP Forums Archive
[FilterScript] Vehicle Bonus Return - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Vehicle Bonus Return (/showthread.php?tid=289824)



Vehicle Bonus Return - OKStyle - 13.10.2011

As we know, since 0.3b we can't get 'secret gifts' from vehicles. Now we can again!

pawn Код:
#include <a_samp>
// Vehicle Bonus Return by O.K.Style™
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        if(IsPlayerNPC(playerid)) return 1;
        new vehicleid = GetPlayerVehicleID(playerid);
        new vehiclemodel = GetVehicleModel(vehicleid);
        switch(vehiclemodel)
        {
            case 417, 425, 447, 460, 469, 476, 487, 488, 497, 511..513, 519, 520, 553, 548, 563, 577, 592, 593: GivePlayerWeapon(playerid, 46, 1);
            case 416:
            {
                if(GetPVarInt(playerid, "BonusVeh") == vehicleid) return 1;
                new Float:hp;
                GetPlayerHealth(playerid, hp);
                if(hp + 20.0 > 100.0) SetPlayerHealth(playerid, 100.0);
                else if(hp + 20.0 <= 100.0) SetPlayerHealth(playerid, 20.0 + hp);
            }
            case 420, 438: GivePlayerMoney(playerid, 12);
            case 427, 601: SetPlayerArmour(playerid, 100.0);
            case 457: GivePlayerWeapon(playerid, 2, 1);
            case 596..599: GivePlayerWeapon(playerid, 25, 5);
            default: return 1;
        }
        SetPVarInt(playerid, "BonusVeh", vehicleid); // disallow multiply getting bonuses
    }
    return 1;
}
public OnVehicleSpawn(vehicleid)
{
    for(new i, j = GetMaxPlayers(); i != j; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerNPC(i)) continue;
        if(GetPVarInt(i, "BonusVeh") != vehicleid) continue;
        SetPVarInt(i, "BonusVeh", -1); // Reset variable for continue getting bonuses after vehicle respawn
    }
    return 1;
}



Re: Vehicle Bonus Return - FireCat - 13.10.2011

Good! (:


Re : Vehicle Bonus Return - TheBest6 - 13.10.2011

Very Good!


AW: Vehicle Bonus Return - BigETI - 13.10.2011

If I continue switching between 2 bonus cars, so I'll get the "secret gifts" again from each vehicle.


Re: AW: Vehicle Bonus Return - wups - 13.10.2011

Quote:
Originally Posted by BigETI
Посмотреть сообщение
If I continue switching between 2 bonus cars, so I'll get the "secret gifts" again from each vehicle.
Exactly. You should make variable for each vehicle, and reset it onvehiclespawn.


Re: Vehicle Bonus Return - Hiddos - 13.10.2011

Could you explain what those bonuses are? I'm not sure I've heard of them 0.o


Re: Vehicle Bonus Return - Mikkel_Pedersen - 13.10.2011

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Could you explain what those bonuses are? I'm not sure I've heard of them 0.o
Like getting a parachute in aeroplanes and helicopters, money in a taxi and armour in an enforcer.


Re : Vehicle Bonus Return - Naruto_Emilio - 13.10.2011

Good job...easy but nice.


Re: Vehicle Bonus Return - Kazuo - 16.10.2011

nice work broo .. awesome !