Why Doesn't work - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why Doesn't work (
/showthread.php?tid=183402)
Why Doesn't work -
rati555 - 15.10.2010
Код:
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
SetTimer("HealthCheck", 1000, 1);
return 1;
}
forward HealthCheck();
public HealthCheck()
{
for(new i=0; i<MAX_PLAYERS; i++){
if(IsPlayerConnected(i)){
new Float:Health;
GetPlayerHealth(i, Health);
if(Health < 50){
ApplyAnimation(i,"SWAT","gnstwall_injurd" , 4.0, 1, 0, 0, 0, 0);//Anim
TogglePlayerControllable(i, 0);// Freeze the player
SetPlayerHealth(i, Health - 1);//Optional for increace player's life, and unfreeze it
}
else{
ClearAnimations(i);
TogglePlayerControllable(i, 1);
}
}
}
}
#endif
This filterscript Doesn't working help me please
Re: Why Doesn't work -
Cameltoe - 15.10.2010
You might want to change a bit of that code, give me a sec ill edit this post
Optimized, Intended. ---> Made it noobish so you would get an better understanding. the script is not tested so i don't guarantee it to work.
pawn Код:
// Includes
#include <a_samp>
// Forwards
forward HealthCheck(playerid);
// Enums
enum PlayerInfo
{
Float: Health,
}
// Symbols
new pInfo[MAX_PLAYERS][PlayerInfo];
// Timers
new HealthTimer[MAX_PLAYERS];
// Callbacks
public OnFilterScriptInit()
{
printf("Health Check By Cameltoe....... <--- o_o --->");
return 1;
}
public OnPlayerConnect(playerid)
{
HealthTimer[playerid] = SetTimerEx("HealthCheck", 1000, true, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(HealthTimer[playerid]);
return 1;
}
// Functions
public HealthCheck(playerid)
{
GetPlayerHealth(playerid, pInfo[playerid][Health]);
if(floatround(pInfo[playerid][Health]) < 50)
{
ApplyAnimation(playerid,"SWAT","gnstwall_injurd" , 4.0, 1, 0, 0, 0, 0);//Anim
TogglePlayerControllable(playerid, 0);// Freeze the player
SetPlayerHealth(playerid, pInfo[playerid][Health] - 1);//Optional for increace player's life, and unfreeze it
}
else
{
ClearAnimations(playerid); // You Would Probably remove this ;)
TogglePlayerControllable(playerid, 1);
}
}
Re: Why Doesn't work -
Jefff - 15.10.2010
Must be
pawn Код:
#define FILTERSCRIPT
#if defined FILTERSCRIPT
or remove if defined and endif