OnPlayerDeath problem
#1

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;
}
Reply
#2

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

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
Reply
#4

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); 
Reply
#5

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
Reply
#6

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

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)
Reply
#8

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?
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)