28.03.2008, 18:20
My new mini-FS.Only 100 lines.
If admin type in game /hpmode,all players can be killed from one shot
Download - http://www.sendspace.com/file/dbpq7k
And Here
If admin type in game /hpmode,all players can be killed from one shot
Download - http://www.sendspace.com/file/dbpq7k
And Here
Code:
#include <a_samp>
new HpModeA = 0;
new HpModeTimer;
new hpmodebug[MAX_PLAYERS];
forward HpMode();
public OnPlayerSpawn(playerid)
{
if(HpModeA == 1)
{
hpmodebug[playerid] = 0;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(HpModeA == 1)
{
hpmodebug[playerid]=1;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if (strcmp(cmd, "/hpmode", true) == 0 && IsPlayerAdmin(playerid) == 1){
if(HpModeA == 1)
{
HpModeA = 0;
GameTextForPlayer(playerid, "~r~Activated", 2000, 4);
KillTimer(HpModeTimer);
}else{
HpModeA = 1;
GameTextForPlayer(playerid, "~g~Deactivated", 2000, 4);
HpModeTimer = SetTimer("HpMode",200, 1);
}
return 1;
}
return 0;
}
public HpMode()
{
new Float:h;
for(new i=0; i<MAX_PLAYERS; i++)
{
GetPlayerHealth(i,h);
if(hpmodebug[i] == 0)
{
if(h < 100)
{
SetPlayerHealth(i,0);
}
}
}
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}


