little 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: little problem (
/showthread.php?tid=473656)
little problem -
gotwarzone - 03.11.2013
I don't understand why when I do /kill it still show "You were killed by" but without a name and without a killer coz obviously I did /kill. And for the gametext there should have no gametext will apear when I do /kill, how?
OnPlayerDeath
Код:
new Batz[128];
format(Batz, sizeof(Batz), "~r~You were killed by ~y~%s", GetName(killerid)); //If Death Show Killer Id
GameTextForPlayer(playerid,Batz, 2000,4);
format(Batz, sizeof(Batz), "~g~You killed %s ~y~+ $2500", GetName(playerid)); //Show Victims name
GameTextForPlayer(killerid,Batz, 2000,4);
Re: little problem -
AlonzoTorres - 03.11.2013
Show us GetName?
Re: little problem -
gotwarzone - 03.11.2013
Here you go
Код:
stock GetName(playerid)
{
new JName[MAX_PLAYER_NAME];
GetPlayerName(playerid,JName,MAX_PLAYER_NAME);
return JName;
}
Re: little problem -
AlonzoTorres - 03.11.2013
Where does killerid come from?
Re: little problem -
gotwarzone - 03.11.2013
Quote:
Originally Posted by AlonzoTorres
Where does killerid come from?
|
it came from
Код:
public OnPlayerDeath(playerid, killerid, reason)
I wonder why I became a killer when I do /kill
Edit: actually not a killer coz if I am the killer it will show like
"You were killed by mynamehere"
Re: little problem -
AlonzoTorres - 03.11.2013
I guess the /kill command is a suicide command? Well why not use this:
pawn Код:
if(killerid == playerid){
GameTextForPlayer(playerid,"You commited suicide...", 2000,4);
}
Re: little problem -
iZN - 03.11.2013
killerid is the player who is killing and the playerid is the one who is getting killed by the killerid.
Re: little problem -
AlonzoTorres - 03.11.2013
Quote:
Originally Posted by iZN
killerid is the player who is killing and the playerid is the one who is getting killed by the killerid.
|
Yes, so if he is doing /kill then he should be both the killer and the one who is killed, right? Otherwise he could just create his own function and override the /kill command.
Re: little problem -
gotwarzone - 03.11.2013
On topic now. I just want to remove and fix the "You were killed by" when I use /kill - suicide. Thats all mate. I made a ss to understand fully.
Код:
new Batz[128];
format(Batz, sizeof(Batz), "~r~You were killed by ~y~%s", GetName(killerid)); //If Death Show Killer Id
GameTextForPlayer(playerid,Batz, 2000,4);
format(Batz, sizeof(Batz), "~g~You killed %s ~y~+ $2500", GetName(playerid)); //Show Victims name
GameTextForPlayer(killerid,Batz, 2000,4);
EDIT: Alonzo you're right. It just need to overdrive the /kill command
Код:
CMD:kill(playerid, params[])
{
SetPlayerHealth(playerid, 0);
return 1;
}
Re: little problem -
AlonzoTorres - 03.11.2013
Quote:
Originally Posted by gotwarzone
EDIT: Alonzo you're right. It just need to overdrive the /kill command
Код:
CMD:kill(playerid, params[])
{
SetPlayerHealth(playerid, 0);
return 1;
}
|
Great, so the problem is solved now?