Problem with OnPlayerDeath
#1

Hi. I have problem with public onplayerdeath.
When you died, it won't respawn you again, ok i gave command when died SpawnPlayer(Playerid) but now it spawn so fast, wihout showing camera death.. Why? How i can fix it?
Here my code of OnPlayerDeath

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(IsPlayerNPC(playerid))
  {
	return 1;
	}
	new name[MAX_PLAYER_NAME];
	new string[256];
	//new dmessage[128];
	//new deathreason[20];
	new Float:px,Float:py,Float:pz;
  DropPlayerWeapons(playerid);
  TogglePlayerSpectating(playerid, 1);
	SpawnPlayer(playerid);
  //SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  //ClearAnimations(playerid);
  SafeResetPlayerWeapons(playerid);
  Checked1[playerid] = 0;
  Checked2[playerid] = 0;
  Checked3[playerid] = 0;
	gPlayerSpawned[playerid] = 0;
	GetPlayerName(playerid, name, sizeof(name));
	PlayerInfo[playerid][pLocal] = MAX_HOUSE;
	GetPlayerPos(playerid, px, py, pz);
	SendDeathMessage(killerid,playerid,reason);
	
	if(PlayerRPKill[playerid] == 1)
	{
	  new house = PlayerInfo[playerid][pPhousekey];
		new bouse = PlayerInfo[playerid][pPbiskey]-MAX_BBUSINESS;
 		new playername[MAX_PLAYER_NAME];
		new rand = random(sizeof(CIV));
		new sendername[MAX_PLAYER_NAME];
		GetPlayerName(playerid, playername, sizeof(playername));
		format(string, sizeof(string), "[%s] you killced as RP noob..[!]", playername);
		OOCNews(COLOR_RED,string);
	  SendClientMessage(playerid, COLOR_BLUE, "[!]You killed...![!]");
		PlayerInfo[playerid][pBabki] = 0;
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "[!]You again idiot..[!]");
		PlayerInfo[playerid][pMember] = 0;
		PlayerInfo[playerid][pLeader] = 0;
		PlayerInfo[playerid][pRank] = 0;
		PlayerInfo[playerid][pChar] = 0;
		SetSpawnInfo(playerid, gTeam[playerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
		PlayerInfo[playerid][pModel] = CIV[rand];
		MedicBill[playerid] = 0;
		HouseInfo[house][hHel] = 0;
		HouseInfo[house][hArm] = 0;
		HouseInfo[house][hHealthx] = 0;
		HouseInfo[house][hHealthy] = 0;
		HouseInfo[house][hHealthz] = 0;
		HouseInfo[house][hArmourx] = 0;
		HouseInfo[house][hArmoury] = 0;
		HouseInfo[house][hArmourz] = 0;
		HouseInfo[house][hLock] = 1;
		HouseInfo[house][hOwned] = 0;
		GetPlayerName(playerid, sendername, sizeof(sendername));
		strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
		ConsumingMoney[playerid] = 1;
		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		format(string, sizeof(string), "~w~ЊOЂѓPA‹‡Eм…•~n~ ‹‘ ЊPOѓA‡… COЂCЏ‹EммOCЏ’ ~n~~g~$%d", HouseInfo[house][hValue]);
		GameTextForPlayer(playerid, string, 10000, 3);
		PlayerInfo[playerid][pPhousekey] = MAX_HOUSE;
		SBizzInfo[bouse][sbLocked] = 1;
		SBizzInfo[bouse][sbOwned] = 0;
		GetPlayerName(playerid, sendername, sizeof(sendername));
		strmid(SBizzInfo[bouse][sbOwner], "The State", 0, strlen("The State"), 255);
		strmid(SBizzInfo[bouse][sbExtortion], "No-one", 0, strlen("No-one"), 255);
		ConsumingMoney[playerid] = 1;
		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		format(string, sizeof(string), "~w~ЊOЂѓPA‹‡•E–~n~ ‹‘ ЊPOѓA‡… C‹O” COЂCЏ‹EммOCЏ’ ЂA ~n~~g~$%d", SBizzInfo[bouse][sbTill]);
		GameTextForPlayer(playerid, string, 10000, 3);
		SBizzInfo[bouse][sbTill] = 0;
		PlayerInfo[playerid][pPbiskey] = MAX_BUSINESS;
		OnPropUpdate();
		GF_OnPlayerUpdate(playerid);
 	}
 	
 	if(BankRobbedTime[playerid] > 0)
  {
    PlayerInfo[playerid][pBabki] -= RobbedMoney[playerid];
    BankRobbedTime[playerid] = 0;
    SendClientMessage(playerid,COLOR_LIGHTRED,"[>]You lost your stupid money from the Bank... get it back!!");
    Tax +=RobbedMoney[playerid];
    RobbedMoney[playerid] = 0;
    BankRobbed = 10;
		for(new c = 0; c < MAX_PLAYERS; c++)
		{
		  if(IsPlayerConnected©)
		  {
				if (IsACop©)
				{
				  SendClientMessage(c,COLOR_RED,"[!!!]Idiot killed gratz!.");

				}
		  }
		}
  }
  
 	if(PlayerHitmanKill[playerid] == 1 && PlayerInfo[playerid][pHeadValue] > 0)
	{
 		new headmoney = PlayerInfo[playerid][pHeadValue]/3;
 		new house = PlayerInfo[playerid][pPhousekey];
		new bouse = PlayerInfo[playerid][pPbiskey]-MAX_BBUSINESS;
 		new playername[MAX_PLAYER_NAME];
		new rand = random(sizeof(CIV));
		new sendername[MAX_PLAYER_NAME];
		new killer[MAX_PLAYER_NAME];
		GetPlayerName(PlayerHitman[playerid], killer, sizeof(killer));
		PlayerInfo[PlayerHitman[playerid]][pWanted] += 60;
		PlayerInfo[PlayerHitman[playerid]][pBabki] += headmoney;
		format(string,128,"*Hitman %s accepted his job %s and took $%d >>",killer,name,headmoney);
		PlayerHitman[playerid] = 999;
		PlayerInfo[playerid][pHeadValue] = 0;
		SendFamilyMessage(8, COLOR_YELLOW, string);
		GetPlayerName(playerid, playername, sizeof(playername));
		format(string, sizeof(string), "*<< %s killed as RP kill >>", playername);
		OOCNews(COLOR_RED,string);
	  SendClientMessage(playerid, COLOR_BLUE, "You killed as hell!!");
		PlayerInfo[playerid][pBabki] = 0;
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "*You again ..");
		PlayerInfo[playerid][pMember] = 0;
		PlayerInfo[playerid][pLeader] = 0;
		PlayerInfo[playerid][pRank] = 0;
		PlayerInfo[playerid][pChar] = 0;
		SetSpawnInfo(playerid, gTeam[playerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
		PlayerInfo[playerid][pModel] = CIV[rand];
		MedicBill[playerid] = 0;
		HouseInfo[house][hHel] = 0;
		HouseInfo[house][hArm] = 0;
		HouseInfo[house][hHealthx] = 0;
		HouseInfo[house][hHealthy] = 0;
		HouseInfo[house][hHealthz] = 0;
		HouseInfo[house][hArmourx] = 0;
		HouseInfo[house][hArmoury] = 0;
		HouseInfo[house][hArmourz] = 0;
		HouseInfo[house][hLock] = 1;
		HouseInfo[house][hOwned] = 0;
		GetPlayerName(playerid, sendername, sizeof(sendername));
		strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
		ConsumingMoney[playerid] = 1;
		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		format(string, sizeof(string), "~w~ЊOЂѓPA‹‡Eм…•~n~ ‹‘ ЊPOѓA‡… COЂCЏ‹EммOCЏ’ ~n~~g~$%d", HouseInfo[house][hValue]);
		GameTextForPlayer(playerid, string, 10000, 3);
		PlayerInfo[playerid][pPhousekey] = MAX_HOUSE;
		SBizzInfo[bouse][sbLocked] = 1;
		SBizzInfo[bouse][sbOwned] = 0;
		GetPlayerName(playerid, sendername, sizeof(sendername));
		strmid(SBizzInfo[bouse][sbOwner], "The State", 0, strlen("The State"), 255);
		strmid(SBizzInfo[bouse][sbExtortion], "No-one", 0, strlen("No-one"), 255);
		ConsumingMoney[playerid] = 1;
		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		format(string, sizeof(string), "~w~ЊOЂѓPA‹‡•E–~n~ ‹‘ ЊPOѓA‡… C‹O” COЂCЏ‹EммOCЏ’ ЂA ~n~~g~$%d", SBizzInfo[bouse][sbTill]);
		GameTextForPlayer(playerid, string, 10000, 3);
		SBizzInfo[bouse][sbTill] = 0;
		PlayerInfo[playerid][pPbiskey] = MAX_BUSINESS;
		OnPropUpdate();
		GF_OnPlayerUpdate(playerid);
 	}
 	if(!IsACop(killerid))
	{
	  PlayerInfo[killerid][pWanted] += 10;
		PlayerDMS[killerid] += 1;
	}
	if(IsACop(killerid) && PlayerInfo[playerid][pWanted] > 0)
	{
		new arrestMoney = PlayerInfo[playerid][pWanted]*5;
		if(PlayerInfo[playerid][pBabki] > arrestMoney)
		{
		  PlayerInfo[killerid][pBabki] += arrestMoney;
			PlayerInfo[playerid][pBabki] -= arrestMoney;
			format(string, sizeof(string), "You got money from cop $%d for kill special action actor.", arrestMoney);
			SendClientMessage(killerid, COLOR_LIGHTRED, string);
			format(string, sizeof(string), You lost it omg .... $%d", arrestMoney);
			SendClientMessage(playerid, COLOR_LIGHTRED, string);
		}
	}
	if (gPlayerCheckpointStatus[playerid] > 4 && gPlayerCheckpointStatus[playerid] < 11)
	{
		DisablePlayerCheckpoint(playerid);
		gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
	}
	new caller = Mobile[playerid];
	if(caller != 255)
	{
		if(caller < 255)
		{
			SendClientMessage(caller, COLOR_GRAD2, "Line is Empty, CALL LATER IDIOT!...");
			CellTime[caller] = 0;
			CellTime[playerid] = 0;
			Mobile[caller] = 255;
			SetPlayerSpecialAction(caller,SPECIAL_ACTION_STOPUSECELLPHONE);
			SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
		}
		Mobile[playerid] = 255;
		CellTime[playerid] = 0;
	}
	ClearCrime(playerid);
	killerid = INVALID_PLAYER_ID;
	SetPlayerColor(playerid,COLOR_GRAD2);
	return 1;
}
Here i gave video:

OnPlayerDeath inccorect works.

Regards.
Reply
#2

Remove or comment out " SpawnPlayer(playerid); "
Reply
#3

LOL. Already fixed ^^
Reply
#4

Quote:
Originally Posted by Toney
LOL. Already fixed ^^
tell us the problem then goofball
Reply
#5

Well, i created new topic about how fix it. http://forum.sa-mp.com/index.php?topic=134833.0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)