i cant freeze player on death.
#1

hello all i tried making a death system and it was working fine until i changed my code and i dont know what i broke down.On death it used to go down and camera was moving away from my character, then i would spawn at the place that i died and if i died again my camera would go up high in the sky to 6000,6000,6000. Now it only directly respawns without going to ground and if i die when im already on the ground i respawn at ground instead of getting my camera up in high.

My onplayerspawn:

Код:
new animloaded[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
	if(animloaded[playerid]==0)
	{
		PreloadAnimLib(playerid,"CARRY");
		PreloadAnimLib(playerid,"RAPPING");
		PreloadAnimLib(playerid,"PAULNMAC");
		PreloadAnimLib(playerid,"STRIP");
		PreloadAnimLib(playerid,"SNM");
		PreloadAnimLib(playerid,"BLOWJOBZ");
		PreloadAnimLib(playerid,"GANGS");
		PreloadAnimLib(playerid,"WUZI");
		PreloadAnimLib(playerid,"SWAT");
		PreloadAnimLib(playerid,"MISC");
		PreloadAnimLib(playerid,"MEDIC");
		PreloadAnimLib(playerid,"GHANDS");
		PreloadAnimLib(playerid,"KISSING");
		PreloadAnimLib(playerid,"PED");
		PreloadAnimLib(playerid,"SWEET");
		PreloadAnimLib(playerid,"SKATE");
		PreloadAnimLib(playerid,"FOOD");
		PreloadAnimLib(playerid,"benchpress");
		PreloadAnimLib(playerid,"CASINO");
		PreloadAnimLib(playerid,"CLOTHES");
		PreloadAnimLib(playerid,"DEALER");
		PreloadAnimLib(playerid,"GYMNASIUM");
		PreloadAnimLib(playerid,"INT_OFFICE");
		PreloadAnimLib(playerid,"BOMBER");
		PreloadAnimLib(playerid,"SHOP");
		PreloadAnimLib(playerid,"COP_AMBIENT");
		PreloadAnimLib(playerid,"BEACH");
		PreloadAnimLib(playerid,"ON_LOOKERS");
		PreloadAnimLib(playerid,"CRACK");
		PreloadAnimLib(playerid,"SMOKING");
		PreloadAnimLib(playerid,"PARK");
		PreloadAnimLib(playerid,"BAR");
		PreloadAnimLib(playerid,"BASEBALL");
		PreloadAnimLib(playerid,"GRAVEYARD");
		PreloadAnimLib(playerid,"INT_HOUSE");
		PreloadAnimLib(playerid,"BD_FIRE");
		PreloadAnimLib(playerid,"CAR");
		PreloadAnimLib(playerid,"LOWRIDER");
		PreloadAnimLib(playerid,"RIOT");
		PreloadAnimLib(playerid,"FAT");
		PreloadAnimLib(playerid,"BSKTBALL");
		PreloadAnimLib(playerid,"FIGHT_E");
		PreloadAnimLib(playerid,"SILENCED");
		PreloadAnimLib(playerid,"KNIFE");
		PreloadAnimLib(playerid,"PARACHUTE");
		PreloadAnimLib(playerid,"GRAFFITI");
  		animloaded[playerid]=1;
		SetPlayerSkillLevel(playerid, 0, 1);
		SetPlayerSkillLevel(playerid, 1, 1);
		SetPlayerSkillLevel(playerid, 2, 1);
		SetPlayerSkillLevel(playerid, 3, 1);
		SetPlayerSkillLevel(playerid, 4, 1);
		SetPlayerSkillLevel(playerid, 5, 1);
		SetPlayerSkillLevel(playerid, 6, 1);
		SetPlayerSkillLevel(playerid, 7, 1);
		SetPlayerSkillLevel(playerid, 8, 1);
		SetPlayerSkillLevel(playerid, 9, 1);
		SetPlayerSkillLevel(playerid, 10, 1);
	}
	SetPlayerColor(playerid, -1);
	spawned[playerid]=1;
	ResetPlayerWeapons(playerid);
	ResetPlayerMoney(playerid);
	SetPlayerMoney(playerid,USER[playerid][MONEY]);
	if(USER[playerid][GUN3]!=0)
	{
	    GivePlayerWeapon(playerid,USER[playerid][GUN3],0);
	}
	if(USER[playerid][GUN2]!=0)
	{
	    GivePlayerWeapon(playerid,USER[playerid][GUN2],USER[playerid][AMMO2]);
	}
	if(USER[playerid][GUN1]!=0)
	{
	    GivePlayerWeapon(playerid,USER[playerid][GUN1],USER[playerid][AMMO1]);
	}
    if(IsDead[playerid] == 1 && InCall[playerid] == 1 && Tallking[playerid] == 1) IsDead[playerid] = 0;
    if(USER[playerid][JAILED]==1)
    {
        SetPlayerPos(playerid,1925.41675, -4316.84766, 2099.71753);
    }
    if(USER[playerid][DEATHS]>=1)
    {
        SetPlayerPos(playerid,pxd[playerid],pyd[playerid],pzd[playerid]);
        SetTimerEx("applydeathanim",5000,false,"i",playerid);
	}
    return 1;
}
My OnPlayerDeath and timer:

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    RemovePlayerAttachedObject(playerid,9);
	ClearAnimations(playerid);
	RemovePlayerAttachedObject(playerid,9);
	ClearAnimations(playerid);
	USER[playerid][SMOKING]=0;
	USER[playerid][GUN1]=0;
	USER[playerid][GUN2]=0;
	USER[playerid][GUN3]=0;
	USER[playerid][AMMO1]=0;
	USER[playerid][AMMO2]=0;
	USER[playerid][AMMO3]=0;
	USER[playerid][MONEY]=GetPlayerMoney(playerid);
	if(USER[playerid][DEATHS]==1)
	{
	    SetTimerEx("die",30000,false,"i",playerid);
	    SetPlayerCameraPos(playerid, 6000, 6000, 6000);
	    SetPlayerCameraLookAt(playerid, 6000, 6000, 6000);
	    TogglePlayerControllable(playerid,0);
	    return 1;
	}
    if(IsDead[playerid] == 1 && InCall[playerid] == 1 && Tallking[playerid] == 1) IsDead[playerid] = 1;
	GetPlayerPos(playerid,pxd[playerid],pyd[playerid],pzd[playerid]);
	if(USER[playerid][DEATHS]==0)
	{
		USER[playerid][DEATHS]=1;
		SendClientMessage(playerid,COLOR_RED, "You are brutally wounded. If you don't get help, you will die.(/acceptdeath to die)");
	}
	return 1;
}
CMD:acceptdeath(playerid, params[])
{
	if(USER[playerid][DEATHS]==1)
	{
	    SetPlayerHealth(playerid,0.00);
	}
	return 1;
}
public die(playerid)
{
	new Money = GetPlayerMoney(playerid);
	new percentmoney = (Money/100)*5;
	if(percentmoney > 999)
	{
		GivePlayerMoneyEx(playerid, -100);
		ClearAnimations(playerid);
		USER[playerid][DEATHS]=0;
		SetPlayerHealth(playerid,100.0);
		SetPlayerPos(playerid,1178.3056,-1323.2146,14.1135);
	}
	else
	{
		GivePlayerMoneyEx(playerid, -percentmoney);
	   	ClearAnimations(playerid);
	   	USER[playerid][DEATHS]=0;
		SetPlayerHealth(playerid,100.0);
		SetPlayerPos(playerid,1178.3056,-1323.2146,14.1135);
	}
	TogglePlayerControllable(playerid,1);
	return 1;
}
Also idk why but i can still use /stopanim even tho its said as if(USER[playerid][DEATHS]==1) return 1; it just stops animation when im on ground:

Код:
CMD:stopanim(playerid,params[])
{
	if(USER[playerid][DEATHS]==1)
	{
		return 1;
	}
	ClearAnimations(playerid);
	return 1;
}
Reply
#2

PHP код:
CMD:stopanim(playeridparams[])
{
  if(
USER[playerid][DEATHS] == 0)
  {
    
ClearAnimations(playerid);
  }
 return 
1;

Reply
#3

i still cant freeze my cam to 6000 6000 6000 when i die when my deaths==1 any idea about that too? i see the position 6000 6000 6000 for half a second then i just come back to where i died in a second and after timer again it gets applied my animation.

also i can still use stopanim:

Quote:
Originally Posted by aoky
Посмотреть сообщение
PHP код:
CMD:stopanim(playeridparams[])
{
  if(
USER[playerid][DEATHS] == 0)
  {
    
ClearAnimations(playerid);
  }
 return 
1;

Reply
#4

anyone help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)