Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <streamer>
- #define MAX_MEDKITS (100)
- new mcount;
- enum MB_INFO
- {
- medboxID[2],
- Float:medboxPosX,
- Float:medboxPosY,
- Float:medboxPosZ,
- medboxCharge,
- bool:medboxCreated
- };
- new MedBoxInfo[MAX_MEDKITS][MB_INFO];
- CreateMedicBox(playerid)
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- MedBoxInfo[mcount][medboxPosX] = X + 3;
- MedBoxInfo[mcount][medboxPosY] = Y;
- MedBoxInfo[mcount][medboxPosZ] = Z - 1;
- MedBoxInfo[mcount][medboxCharge] = 25;
- MedBoxInfo[mcount][medboxCreated] = true;
- MedBoxInfo[mcount][medboxID][0] = CreateDynamicObject(11736, MedBoxInfo[mcount][medboxPosX], MedBoxInfo[mcount][medboxPosY], MedBoxInfo[mcount][medboxPosZ], 0.0, 0.0, 0.0);
- MedBoxInfo[mcount][medboxID][1] = CreateDynamicObject(19606, MedBoxInfo[mcount][medboxPosX], MedBoxInfo[mcount][medboxPosY], MedBoxInfo[mcount][medboxPosZ] - 1.5, 0.0, 0.0, 0.0);
- mcount++;
- return 1;
- }
- DestroyMedicBox(medbox)
- {
- MedBoxInfo[medbox][medboxPosX] = 0;
- MedBoxInfo[medbox][medboxPosY] = 0;
- MedBoxInfo[medbox][medboxPosZ] = 0;
- MedBoxInfo[medbox][medboxCharge] = 0;
- MedBoxInfo[medbox][medboxCreated] = false;
- DestroyDynamicObject(MedBoxInfo[medbox][medboxID][0]);
- DestroyDynamicObject(MedBoxInfo[medbox][medboxID][1]);
- return 1;
- }
- forward CheckMedicBox(playerid);
- public CheckMedicBox(playerid)
- {
- new Float:gArmour, Float:gHealth, Float:Result;
- GetPlayerArmour(playerid, gArmour);
- GetPlayerHealth(playerid, gHealth);
- Result = gArmour + gHealth;
- for(new i; i < sizeof(MedBoxInfo); ++i)
- {
- if(IsPlayerInRangeOfPoint(playerid, 0.5, MedBoxInfo[i][medboxPosX], MedBoxInfo[i][medboxPosY], MedBoxInfo[i][medboxPosZ]))
- {
- if(MedBoxInfo[i][medboxCreated])
- {
- if(Result == 200.0)
- return 1;
- PlayerPlaySound(playerid, 45400, 0.0, 0.0, 0.0);
- if(gArmour < 100 && gHealth == 100)
- SetPlayerArmour(playerid, gArmour + 20.0);
- if(gHealth < 100)
- SetPlayerHealth(playerid, gHealth + 20.0);
- if(!MedBoxInfo[i][medboxCharge])
- return DestroyMedicBox(i);
- MedBoxInfo[i][medboxCharge]--;
- }
- }
- }
- return 1;
- }
- forward ServerUpdate();
- public ServerUpdate()
- {
- for(new i; i < MAX_PLAYERS; ++i)
- CheckMedicBox(i);
- return 1;
- }
- main()
- {
- return 1;
- }
- public OnGameModeInit()
- {
- SetTimer("ServerUpdate", 1000, true);
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- CMD:setvida(playerid)
- {
- SetPlayerArmour(playerid, 0.0);
- SetPlayerHealth(playerid, 20.0);
- return 1;
- }
- CMD:medkit(playerid)
- {
- CreateMedicBox(playerid);
- return 1;
- }
Advertisement
RAW Paste Data
Copied
Advertisement