Jump to content
  • 0

pomoc Help - OnPlayerDeath


Anonimus24

Dotaz

Ahoj mám dotaz když nastavím komukoliv HP na 0 nebo i když umře jakýmkoliv způsobem zůstane takto živ. Pokud bych skočil z té budovy viz fotka normálně by mě to zabilo.
Doufám že jsme problém popsal dobře bohužel nevím kdo může být chyba... 

 

Spoiler

public OnPlayerDeath(playerid, killerid, reason)
{
 	/*new IDZONA =  GetZonaBalicek(playerid);
 	if(IDZONA != -1)
	{
		BalicekCreateDeath(playerid);
 	}*/
 	if(PlayerInSkola[playerid] == 1)
	{
	    SPIB2(playerid, "~r~Autoskola zrusena!", 5);
		ZrusPlayerSkola(playerid);
	}
	//PripojHracPort[playerid] = 0;
    //Player[playerid][LCity] = IsPlayerInCityRace(playerid);
    SendDeathMessage(killerid,playerid,reason);
	UpdatePlayerDeaths(playerid);
	UpdatePlayerKills(killerid);
	//--------------------------------------------------------------------------
    PlayerSpawnEx(playerid);
	//--------------------------------------------------------------------------
	ResetGun(playerid);
	//--------------------------------------------------------------------------
	return 1;
}

 

Spoiler

CMD:hp(playerid, params[])
{
    if(Player[playerid][AdminLevel]==0) 				return SendErrorMessage(playerid,"Nemáte Administrátorská pravá.");
	else if(Player[playerid][AdminLevelAkce] == 0) 		return SendErrorMessage(playerid,"Nemáte dostatečný Administrátorská pravá.");
	{
		new id = strval(params),hp;

 		if(sscanf(params,"ui",id,hp)) 			return SendErrorMessage(playerid,"Použití: /Hp [ID] [HEALT].");
  		else if(hp > 100 || hp < 0)				return SendErrorMessage(playerid,";Nápověda: /Hp [ID] [0-100].");
   		else if(IsPlayerNPC(id)) 				return SendErrorMessage(playerid,"Zadané ID má NPC.");
    	else if(!IsPlayerConnected(id)) 		return SendErrorMessage(playerid,"Hráč není na serveru.");

		SetPlayerHealth(id, hp);
  		SCMF(128,id,COLOR_GREEN_LIGHT,"[ ! ] {FFFFFF}Administrátor %s vám nastavil život na %d",PlayerName(playerid),hp);
   		SCMF(128,playerid,COLOR_GREEN_LIGHT,"[ ! ] {FFFFFF}Nastavil jste hráči %s život na %d",PlayerName(id),hp);

		Log_Write(128,id,"(AT)\tAdministrátor %s vám nastavil život na %d",PlayerName(playerid),hp);
  		Log_Write(128,playerid,"(AT)\tNastavil jste hráči %s život na %d",PlayerName(id),hp);
	}
	return 1;
}

 

 

sa-mp-003.png

Link to comment
Share on other sites

4 odpovědí na tuto otázku

Recommended Posts

  • 0

Ak niekomu nastavíš hp na 0 alebo sa zabije sám pádom, ohňom, výbuchom, utopením, ..., počítaj s tým, že killerid je INVALID_PLAYER_ID (65535). Ak používaš index killerid na prístup do nejakého poľa, tak ti to tam spadne na ArrayIndexOfBoundsException. Z tohto dôvodu sa kód, ktorý robí niečo s killerid, zvykne dávať do tela podmienky if (killerid != INVALID_PLAYER_ID). Je možné, že niečo také robíš v UpdatePlayerKills. Inak na odhalenie takýchto chýb určite použi crashdetect plugin

Edited by DuFF
Link to comment
Share on other sites

  • 0
před 2hodinami, DuFF said:

Ak niekomu nastavíš hp na 0 alebo sa zabije sám pádom, ohňom, výbuchom, utopením, ..., počítaj s tým, že killerid je INVALID_PLAYER_ID (65535). Ak používaš index killerid na prístup do nejakého poľa, tak ti to tam spadne na ArrayIndexOfBoundsException. Z tohto dôvodu sa kód, ktorý robí niečo s killerid, zvykne dávať do tela podmienky if (killerid != INVALID_PLAYER_ID). Je možné, že niečo také robíš v UpdatePlayerKills. Inak na odhalenie takýchto chýb určite použi crashdetect plugin

 

 

Asi ne když už chybu nasel

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...