SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/06/2017, 09:07 PM   #1
StR_MaRy
Gangsta
 
Join Date: Aug 2011
Posts: 772
Reputation: 6
Default OnPlayerDeath problem

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 Code:
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;
}

Last edited by StR_MaRy; 20/06/2017 at 10:35 AM.
StR_MaRy is offline   Reply With Quote
Old 20/06/2017, 02:44 AM   #2
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 776
Reputation: 47
Default Re: OnPlayerDeath problem

I don't understand the problem, What are you trying to do? What do you need?
__________________
JasonRiggs is offline   Reply With Quote
Old 20/06/2017, 10:36 AM   #3
StR_MaRy
Gangsta
 
Join Date: Aug 2011
Posts: 772
Reputation: 6
Default Re: OnPlayerDeath problem

Quote:
Originally Posted by JasonRiggs View Post
I don't understand the problem, What are you trying to do? What do you need?
HTML Code:
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
StR_MaRy is offline   Reply With Quote
Old 20/06/2017, 02:57 PM   #4
KizZweLL
Little Clucker
 
KizZweLL's Avatar
 
Join Date: Jan 2016
Location: Philippines
Posts: 26
Reputation: 0
Default Re: OnPlayerDeath problem

PHP Code:
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 Code:
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); 
__________________
Sometimes impossible can turn into reality.
KizZweLL is offline   Reply With Quote
Old 20/06/2017, 09:42 PM   #5
StR_MaRy
Gangsta
 
Join Date: Aug 2011
Posts: 772
Reputation: 6
Default Re: OnPlayerDeath problem

Quote:
Originally Posted by KizZweLL View Post
PHP Code:
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 Code:
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
StR_MaRy is offline   Reply With Quote
Old 20/06/2017, 11:04 PM   #6
Threshold
High-roller
 
Threshold's Avatar
 
Join Date: Nov 2012
Location: Australia
Posts: 3,102
Reputation: 521
Default Re: OnPlayerDeath problem

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

Kar's Cops and Robbers 2019
Threshold is offline   Reply With Quote
Old 20/06/2017, 11:27 PM   #7
StR_MaRy
Gangsta
 
Join Date: Aug 2011
Posts: 772
Reputation: 6
Default Re: OnPlayerDeath problem

Quote:
Originally Posted by Threshold View Post
Have you checked if 'killerid' is a valid player ID...?
yea i did

under this is what i posted
HTML Code:
if(killerid != INVALID_PLAYER_ID)
StR_MaRy is offline   Reply With Quote
Old 20/06/2017, 11:43 PM   #8
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 357
Reputation: 115
Default Re: OnPlayerDeath problem

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?
Pizzy is offline   Reply With Quote
Old 21/06/2017, 12:04 AM   #9
StR_MaRy
Gangsta
 
Join Date: Aug 2011
Posts: 772
Reputation: 6
Default Re: OnPlayerDeath problem

Quote:
Originally Posted by Pizzy View Post
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
StR_MaRy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem on OnPlayerDeath Vindicated Scripting Help 2 30/06/2014 06:28 PM
OnPlayerDeath Problem SeanT950 Scripting Help 4 19/06/2014 11:52 AM
OnPlayerDeath problem zombieking Scripting Help 3 05/01/2013 12:13 PM
OnPlayerDeath Problem berz Help Archive 1 28/01/2011 07:12 PM
Problem with OnPlayerDeath...Need Help *BueNoOo* Help Archive 3 27/06/2009 09:50 PM


All times are GMT. The time now is 03:22 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.