30.04.2012, 21:41
when someone drink from the drink machine the health is up and then going down again
#include <a_samp> #define MAX_WEAPONS 46 new Float:CarHP[MAX_VEHICLES]; new pCash[MAX_PLAYERS] = 0; new Hweapon[MAX_PLAYERS][13]; new Hammo[MAX_PLAYERS][MAX_WEAPONS]; new Float:pHp[MAX_PLAYERS]; new Float:pArmour[MAX_PLAYERS]; new timervalue = 2; stock GivePlayerCash(playerid, amount) { pCash[playerid] += amount; } stock GetPlayerCash(playerid) { return pCash[playerid]; } stock SetCarHealth(vehicle,Float:amout) { SetVehicleHealth(vehicle, amout); new Float:d; GetVehicleHealth(vehicle,d); CarHP[vehicle] = d; return 1; } stock GetCarHealth(vehicle) { return CarHP[vehicle]; } stock SetPlayerCash(playerid,amout) { pCash[playerid] = amout; } stock FixVehicle(vehicleid) { SetCarHealth(vehicleid,1000.0); RepairVehicle(vehicleid); } stock CheckAirbreak(Float: oldpos, Float: newpos) { new Float: floattab1 = floatabs(oldpos - newpos); new Float: floattab2 = floatabs(newpos - oldpos); new Float: mindifferenz = timervalue * 12.5; if(floattab1 > mindifferenz) { return true; } else if(floattab2 > mindifferenz) { return true; } else { return false; } } stock TakeGunSlot1(playerid) { ResetPlayerWeapons(playerid); Hweapon[playerid][1] = 0; Hammo[playerid][1] = 0; GivePlayerWeapon(playerid, Hweapon[playerid][2], Hammo[playerid][2]); GivePlayerWeapon(playerid, Hweapon[playerid][3], Hammo[playerid][3]); GivePlayerWeapon(playerid, Hweapon[playerid][4], Hammo[playerid][4]); GivePlayerWeapon(playerid, Hweapon[playerid][5], Hammo[playerid][5]); GivePlayerWeapon(playerid, Hweapon[playerid][6], Hammo[playerid][6]); GivePlayerWeapon(playerid, Hweapon[playerid][7], Hammo[playerid][7]); GivePlayerWeapon(playerid, Hweapon[playerid][8], Hammo[playerid][8]); GivePlayerWeapon(playerid, Hweapon[playerid][9], Hammo[playerid][9]); GivePlayerWeapon(playerid, Hweapon[playerid][10], Hammo[playerid][10]); GivePlayerWeapon(playerid, Hweapon[playerid][11], Hammo[playerid][11]); GivePlayerWeapon(playerid, Hweapon[playerid][12], Hammo[playerid][12]); } stock RestartGuns(playerid) { ResetPlayerWeapons(playerid); /*GivePlayerWeapon(playerid, Hweapon[playerid][1], Hammo[playerid][1]); GivePlayerWeapon(playerid, Hweapon[playerid][2], Hammo[playerid][2]); GivePlayerWeapon(playerid, Hweapon[playerid][3], Hammo[playerid][3]); GivePlayerWeapon(playerid, Hweapon[playerid][4], Hammo[playerid][4]); GivePlayerWeapon(playerid, Hweapon[playerid][5], Hammo[playerid][5]); GivePlayerWeapon(playerid, Hweapon[playerid][6], Hammo[playerid][6]); GivePlayerWeapon(playerid, Hweapon[playerid][7], Hammo[playerid][7]); GivePlayerWeapon(playerid, Hweapon[playerid][8], Hammo[playerid][8]); GivePlayerWeapon(playerid, Hweapon[playerid][9], Hammo[playerid][9]); GivePlayerWeapon(playerid, Hweapon[playerid][10], Hammo[playerid][10]); GivePlayerWeapon(playerid, Hweapon[playerid][11], Hammo[playerid][11]); GivePlayerWeapon(playerid, Hweapon[playerid][12], Hammo[playerid][12]);*/ return 1; } stock GivePlayerGun(playerid,weaponid,ammo) { Hweapon[playerid][WeaponSlot(weaponid)] = weaponid; Hammo[playerid][weaponid] += ammo; GivePlayerWeapon(playerid,weaponid,ammo); } stock WeaponSlot(weaponid) { switch (weaponid) { case 0,1: return 0; case 2..9: return 1; case 10..15: return 10; case 16..18,39: return 8; case 22..24: return 2; case 25..27: return 3; case 28,29,32: return 4; case 33,34: return 6; case 35..38: return 7; case 41..43: return 9; case 44..46: return 11; default: return 12; } return true; }