13.10.2011, 05:08
(
Последний раз редактировалось OKStyle; 13.10.2011 в 09:51.
)
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;
}