SA-MP Forums Archive
problem on ONPLAYERDEATH [+3rep] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: problem on ONPLAYERDEATH [+3rep] (/showthread.php?tid=392776)



problem on ONPLAYERDEATH [+3rep] - Amine_Mejrhirrou - 15.11.2012

what i'm trying to do is :
when a player (in team != 30) die ! i want to give a function to all the players next to the player who is dead ! this is my scripts but it's not working properly
Код:
	new Float:X, Float:Y, Float:Z;


	if(GetPlayerTeam(playerid) != 30)
	{
		GetPlayerPos(playerid,X,Y,Z);
		for (new i = 0; i < MAX_PLAYERS; i++)
		{
  					if(IsPlayerInRangeOfPoint(i, 10, X, Y, Z))
					{
					    	if(GetPlayerTeam(i) != 30) return 1;
						GivePlayerExp(i, 100, "~r~player dead");
					}
		}
		return 1;
	}



Re: problem on ONPLAYERDEATH [+3rep] - Tomejus - 15.11.2012

I think there's no people around, because when you die you spawn somewhere, and I'm pretty sure that this function is called while/after spawning.


Re : problem on ONPLAYERDEATH [+3rep] - Amine_Mejrhirrou - 15.11.2012

no this fuction is called at onplayerdeath !
the thing is that sometime ! it works (maybe if the player attacked the dead player befor he died XD hope u understand what i mean ) sometime it's not working !


Re: problem on ONPLAYERDEATH [+3rep] - Tomejus - 15.11.2012

You could try this:
Код:
					    	if( GetPlayerTeam( i ) == 30 )
					    	{
								GivePlayerExp( i, 100, "~r~player dead" );
							}
But I'm not sure that helps (it's just better way to do this, in my opinion), rest of the code looks that it should work, I just don't know how OnPlayerDeath works exactly.


Re : problem on ONPLAYERDEATH [+3rep] - Amine_Mejrhirrou - 15.11.2012

this is going to apply the function on players who are in team 30 ! i'm searching to apply that on plyaers who are not in team 30


Re: problem on ONPLAYERDEATH [+3rep] - Face9000 - 15.11.2012

pawn Код:
if(!GetPlayerTeam[playerid] == 30)
{
//Your code
}



Re: Re : problem on ONPLAYERDEATH [+3rep] - Tomejus - 15.11.2012

Quote:
Originally Posted by Amine_Mejrhirrou
Посмотреть сообщение
this is going to apply the function on players who are in team 30 ! i'm searching to apply that on plyaers who are not in team 30
No, this is your code in another way. You see, you do - if(GetPlayerTeam(i) != 30) return 1; which means that if player(s) are not in 30 you return a function, that basically means if( GetPlayerTeams( i ) == 30 ) { //your code }... if you want do in another way you don't have to return a function, do you get it?


Re : problem on ONPLAYERDEATH [+3rep] - Amine_Mejrhirrou - 15.11.2012

TOEJUS well if it's my code in an othere way the result should be the same ?
Logitech90 if i put "!" in the beging it the same thing that if i put != , the result should be the same too