Is it possible to stop someone from spawning?
#1

im trying to make a death system but i dont know why it doesnt work.

when i first die i get my

Код:
USER[playerid][DEATHS]
as 1 but when i die again my camera goes up to 6000 6000 6000 again and back i die again instead of spawning correctly after 30 second. Can anybody help? (btw if i walk in to fire after dying 30 seconds work properly but it doesnt when player kills me again or i use acceptdeath)

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	killerid=INVALID_PLAYER_ID;
	reason=WEAPON_FLAMETHROWER;
    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;
}
Reply
#2

I may be wrong, but why are you using the same codes on "public die"?
Reply
#3

i need a timer to spawn me after i prevent myself from spawning for the first 30 seconds right ? I mean i believe thats how it should be thats why i did that. well i must say this used to work before but i developed my game mode more and more. I can explain more like this i guess. when you die you fall to ground and camera moves away from you(thats how it was before and it was working), but now i dont fall to ground i instantly respawn after dying instantly like even before the code can be processed thru i spawn back. So i cant be dead for 30 seconds and camera moves back to player when i spawn because i cant stay dead.

EDIT: Also i tried "SendDeathMessage(playerid,killerid,reason);" i cant send death message too because respawn happens so quickly.
Reply
#4

Does player goes to spectating mode when died?? if not try toggling spectating mode.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)