SA-MP Forums Archive
Qustion.. - 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)
+--- Thread: Qustion.. (/showthread.php?tid=292708)



Qustion.. - [M.A]Angel[M.A] - 24.10.2011

Helllo!,

Guys i want to ask, i learning C# lang and there are in C# some cmd Called "While" , so nice idea to say in script of samp :

Quote:

while(Health>100) //If Get Player health more than 100 Player got auto ban.
{
Ban(playerid);
}

Guys look at this maybe worked

Quote:

new Float:health = GetPlayerHealth(playerid);

while(health>100)
{
Ban(playerid);
}

But i fail with "Health" what can i put in? Is this possible to do ??


Re: Qustion.. - spd_sahil - 24.10.2011

See.. FIRSTLY use

pawn Код:
if(health>100)

Quote:
Originally Posted by [M.A]Angel[M.A]
Посмотреть сообщение
Helllo!,


But i fail with "Health" what can i put in? Is this possible to do ??
and i didnt get this question..

if u wanna make a health check timer...

pawn Код:
OnGameModeInit()
{
SetTimer("HealthCheck",10,1);
}
forward HealthCheck();
public HealthCheck()
{
for(new i ; i < MAX_PLAYERS ; i++)
{
if(IsPlayerConnected(i))
{
new Health = GetPlayerHealth(i);
if(Health>100)
{
Ban(i);
}
}
}
}
Now this code .. will check all the time.. ALL PLAYERS.. if any player's health goes above hundread.. he be banned


Re : Qustion.. - [M.A]Angel[M.A] - 24.10.2011

Thanks Too much! , perfect solution!