SA-MP Forums Archive
OnPlayerDeath problem - 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: OnPlayerDeath problem (/showthread.php?tid=636088)



OnPlayerDeath problem - StR_MaRy - 19.06.2017

Hey guys i have an event sistem that players should kill each other but the problem is if i or someone else kills someone i will say "Batman killed Unknown with a Deagle."

Код HTML:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(ZombieModePlayer[playerid] == 1)
	{
	    if(HumanPlayer[playerid] == 1)
	    {
		    HumanPlayersOn--;
	        HumanPlayer[playerid] = 0;

		    format(gString, sizeof(gString), "{FF0000}[Zombie Event]: {A9C4E4}%s {FFFFFF}a fost omorit de {A9C4E4}%s {FFFFFF}rolul decedatului: Supravietuitor", GetName(playerid), GetName(killerid));
			SendZmMessage(gString, COLOR_WHITE);
		}
		if(ZombiePlayer[playerid] == 1)
		{
			ZombiePlayersOn--;
		    ZombiePlayer[playerid] = 0;
			    
		    format(gString, sizeof(gString), "{FF0000}[Zombie Event]: {A9C4E4}%s {FFFFFF}a fost omorit de {A9C4E4}%s {FFFFFF}rolul decedatului: Zombie", GetName(playerid), GetName(killerid));
			SendZmMessage(gString, COLOR_WHITE);
		}
	}
	return 1;
}



Re: OnPlayerDeath problem - JasonRiggs - 20.06.2017

I don't understand the problem, What are you trying to do? What do you need?


Re: OnPlayerDeath problem - StR_MaRy - 20.06.2017

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
I don't understand the problem, What are you trying to do? What do you need?
Код HTML:
format(gString, sizeof(gString), "{FF0000}[Zombie Event]: {A9C4E4}%s {FFFFFF}got killed by {A9C4E4}%s {FFFFFF}role: Zombie", GetName(playerid), GetName(killerid));
SendZmMessage(gString, COLOR_WHITE);
so when i kill someone me or someone else it's saying "Batman got killed by Unknown" this Unknown is a problem should say the killer's name


Re: OnPlayerDeath problem - KizZweLL - 20.06.2017

PHP код:
format(gStringsizeof(gString), "{FF0000}[Zombie Event]: {A9C4E4}%s {FFFFFF}got killed by {A9C4E4}%s {FFFFFF}role: Zombie"GetName(playerid), GetPlayerName(killerid));
SendZmMessage(gString, -1); 
Or

PHP код:
new KillerName[MAX_PLAYER_NAME],gString[126];
GetPlayerName(killerid,KillerName,sizeof(KillerName));
format(gString,sizeof(gString),"{FF0000}[Zombie Event]: {A9C4E4}%s {FFFFFF}got killed by {A9C4E4}%s {FFFFFF}role: Zombie"GetName(playerid), KillerName);

SendClientMessageToAll(-1,gString); 



Re: OnPlayerDeath problem - StR_MaRy - 20.06.2017

Quote:
Originally Posted by KizZweLL
Посмотреть сообщение
PHP код:
format(gStringsizeof(gString), "{FF0000}[Zombie Event]: {A9C4E4}%s {FFFFFF}got killed by {A9C4E4}%s {FFFFFF}role: Zombie"GetName(playerid), GetPlayerName(killerid));
SendZmMessage(gString, -1); 
Or

PHP код:
new KillerName[MAX_PLAYER_NAME],gString[126];
GetPlayerName(killerid,KillerName,sizeof(KillerName));
format(gString,sizeof(gString),"{FF0000}[Zombie Event]: {A9C4E4}%s {FFFFFF}got killed by {A9C4E4}%s {FFFFFF}role: Zombie"GetName(playerid), KillerName);
SendClientMessageToAll(-1,gString); 
dosen't work .. now i am getting nothing like "You get killed by 'space' role: etc...

that 'space' is just an empty line


Re: OnPlayerDeath problem - Threshold - 20.06.2017

Have you checked if 'killerid' is a valid player ID...?


Re: OnPlayerDeath problem - StR_MaRy - 20.06.2017

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Have you checked if 'killerid' is a valid player ID...?
yea i did

under this is what i posted
Код HTML:
if(killerid != INVALID_PLAYER_ID)



Re: OnPlayerDeath problem - Pizzy - 20.06.2017

I recommend you copy + paste everything you've got under the OnPlayerDeath, and put it in a notepad.

Now re-make it, with the simple barebones, no checking if they're in the zombie event or anything - recompile and test.

Does it display the names correctly? -> Re-build the whole thing in sections, and as soon as it stops working - whatever you've just re-added has the fault.
Does it still not display the names correctly? -> Looks like your 'GetName' function is broken?


Re: OnPlayerDeath problem - StR_MaRy - 20.06.2017

Quote:
Originally Posted by Pizzy
Посмотреть сообщение
I recommend you copy + paste everything you've got under the OnPlayerDeath, and put it in a notepad.

Now re-make it, with the simple barebones, no checking if they're in the zombie event or anything - recompile and test.

Does it display the names correctly? -> Re-build the whole thing in sections, and as soon as it stops working - whatever you've just re-added has the fault.
Does it still not display the names correctly? -> Looks like your 'GetName' function is broken?
same... Unknown i just putted only the message to inform who killed me ... still Unknown

EDIT: SOLVED