10.01.2010, 21:04
I am new to scripting and am having trouble with this part of my script.
Basically I am trying to simulate the health regen thing from COD 4, and cant make it work!! I have tried searching for topics that could help for days, and tried lots of stuff myself but cant find anything so help is much appreciated!
This is what I have tried:
It works fine for playerid 0, but no-one else.
I am also trying to do kill / death streaks, the same as COD4, but these do not work either. Does anyone know an easy way to do it?
Please help ! :P
THanks, Benyaminx
Basically I am trying to simulate the health regen thing from COD 4, and cant make it work!! I have tried searching for topics that could help for days, and tried lots of stuff myself but cant find anything so help is much appreciated!
This is what I have tried:
Код:
new Float:healthreg [MAX_PLAYERS]; public OnPlayerUpdate (playerid) //UPDATE { GetPlayerHealth(playerid, healthreg [playerid]); return 1; } public HealthTimer2 (playerid) { if (healthreg [playerid] < 50) { SetPlayerHealth (playerid, healthreg [playerid] +8); return 1; } else if (healthreg [playerid] > 50) { SetPlayerHealth (playerid, 50.0); return 1; } return 1; }
I am also trying to do kill / death streaks, the same as COD4, but these do not work either. Does anyone know an easy way to do it?
Код:
public OnPlayerDeath (playerid, killerid, reason) streak [killerid]++; streak [playerid] = 0; deathstreak [playerid]++; deathstreak [killerid] = 0; //killstreak_______________________________________________________________________________________________________________________________________ if (streak [killerid] == 3) { uav [killerid] = 1; SendClientMessage (killerid,GREEN, "Kill Streak of 3! You earned a UAV. Type /UAV to use. -+- UNDER CONSTRUCTION - DO NOT USE!! -+-."); return 1; } else if (streak [killerid] == 5) { airstrike [killerid] = 1; SendClientMessage (killerid,GREEN, "Kill Streak of 5! You earned a Airstrike. Type /airstrike to use."); return 1; } else if (streak [killerid] == 10) { helicopter [killerid] =1; SendClientMessage (killerid,GREEN, "Kill Streak of 10! You earned a Helicopter. Type /heli to use. -+- UNDER CONSTRUCTION - DO NOT USE!! -+-."); return 1; } //more deathstreak________________________________________________________________________________________________________________________________________________________ if (deathstreak [playerid] == 3) { dynamite [playerid] = 1; SendClientMessage (playerid,GREEN, "Death Streak of 3! Get your act together - heres some dynamite!"); return 1; } else if (deathstreak [playerid] == 5) { minigun [playerid] = 1; SendClientMessage (playerid,GREEN, "Death Streak of 5! Get your act together - heres a minigun!"); return 1; } else if (deathstreak [playerid] == 10) { above [playerid] = 1; SendClientMessage (playerid,GREEN, "Death Streak of 10! Get your act together - rain death from above!"); return 1; } return 1; }
THanks, Benyaminx