PLayer health -
darkmagic2 - 07.08.2010
How can i make that if a person is low on health like 50% an animation will play like /injured and they cant move until their health is high again like 70%. ALso can someone please give a tutorial for maping?
Re: PLayer health -
Cameltoe - 07.08.2010
Search on ******* for the mapping thing MTA map editor etc.
Re: PLayer health -
ViruZZzZ_ChiLLL - 07.08.2010
On the health thing, it basically goes like this :
pawn Код:
new Float:health;
GetPlayerHealth(playerid, health)
if(health => 50)
{
// do somethings here
}
Well, I don't know the animation, sorry.
Re: PLayer health -
Scarface~ - 07.08.2010
new Float:health;
GetPlayerHealth(playerid, health)
if(health => 50)
{
ApplyAnimationEx(playerid,"SWAT","gnstwall_injurd" , 4.0, 1, 0, 0, 0, 0);//Anim
TogglePlayerControllable(playerid, 0);// Freeze the player
}
Re: PLayer health -
Cameltoe - 07.08.2010
Shouldnt freeze the player, should add a loop to the anim.
Re: PLayer health -
vital2k - 07.08.2010
And then just place it on a timer or check.
Re: PLayer health -
Scarface~ - 07.08.2010
Quote:
Originally Posted by Cameltoe
Shouldnt freeze the player, should add a loop to the anim.
|
Its better to freeze the player, as it can be abused by pressing F and Jump, Trust me i've had it on my server
Re: PLayer health -
darkmagic2 - 07.08.2010
sry but im a noob at this the
new Float:health;
GetPlayerHealth(playerid, health)
if(health => 50)
{
ApplyAnimationEx(playerid,"SWAT","gnstwall_injurd" , 4.0, 1, 0, 0, 0, 0);//Anim
TogglePlayerControllable(playerid, 0);// Freeze the player
}
should i add it at in my GM at the end? and like this?
{
new Float:health;
GetPlayerHealth(playerid, health)
if(health => 50)
{
ApplyAnimationEx(playerid,"SWAT","gnstwall_injurd" , 4.0, 1, 0, 0, 0, 0);//Anim
TogglePlayerControllable(playerid, 0);// Freeze the player
}
Re: PLayer health -
TheChaoz - 07.08.2010
no, what you can do is create a timer OnGameModeInit. something like this:
pawn Код:
public OnGameModeInit()
{
//your OnGameModeInitCode
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){
ApplyAnimationEx(playerid,"SWAT","gnstwall_injurd" , 4.0, 1, 0, 0, 0, 0);//Anim
TogglePlayerControllable(playerid, 0);// Freeze the player
SetPlayerHealth(i, Health + 1);//Optional for increace player's life, and unfreeze it
}
else{
ClearAnimations(i);
TogglePlayerControllable(playerid, 1);
}
}
}
}
Re: PLayer health -
darkmagic2 - 07.08.2010
i get this
D:\san andreas SERVER\gamemodes\larp.pwn(81127) : error 021: symbol already defined: "Streamer_OnGameModeInit"
D:\san andreas SERVER\gamemodes\larp.pwn(81141) : error 017: undefined symbol "ApplyAnimationEx"
D:\san andreas SERVER\gamemodes\larp.pwn(81142) : error 017: undefined symbol "playerid"
D:\san andreas SERVER\gamemodes\larp.pwn(81147) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: PLayer health -
RichyB - 07.08.2010
First look at the lines which say undefined symbol "playerid"
Go to them and replace playerid with i.
Then With ApplyAnimationEx remove Ex off ApplyAnimation.
And Remove the Streamer_OnGamemodeInit Function.
Its already been defined in the script.
Re: PLayer health -
TheChaoz - 07.08.2010
here, my fault:
pawn Код:
public OnFilterScriptInit()
{
//your OnGameModeInitCode
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);
}
}
}
}