[FilterScript] Vehicle Bonus Return
#1

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;
}
Reply
#2

Good! (:
Reply
#3

Very Good!
Reply
#4

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

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.
Reply
#6

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

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.
Reply
#8

Good job...easy but nice.
Reply
#9

nice work broo .. awesome !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)