SA-MP Forums Archive
[Solved] Simple Death Message - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Solved] Simple Death Message (/showthread.php?tid=68040)



[Solved] Simple Death Message - Alec24 - 06.03.2009

I just want a message to appear saying:

"<PlayerName> Has Died!"

I have
Код:
SendPlayerMessageToAll(GetPlayerName(playerid)" Has Died");



Re: Simple Death Message - maij - 06.03.2009

well this is pretty obvious, use format
pawn Код:
new string[100];//can be any good size

format(string, sizeof(string),"%S Has Died",GetPlayerName(playerid) );

SendPlayerMessageToAll(string);



Re: Simple Death Message - Nimphious - 06.03.2009

Quote:

new string[100];//can be any good size

well I would use 28 :P


Re: Simple Death Message - Alec24 - 06.03.2009

There is one error.

Код:
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\Freeroam.pwn(577) : warning 202: number of arguments does not match definition
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\Freeroam.pwn(577) : warning 202: number of arguments does not match definition
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\Freeroam.pwn(578) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Simple Death Message - maij - 06.03.2009

well, cant solve your problems only with the errors, give us the lines of code (577,57

otherwise we cant do anything lol


Re: Simple Death Message - Alec24 - 06.03.2009

It was just what maij told me

Код:
format(string, sizeof(string),"%S Has Died",GetPlayerName(playerid));
SendPlayerMessageToAll(string);



Re: Simple Death Message - maij - 06.03.2009

Quote:
Originally Posted by AlecRae
It was just what maij told me

Код:
format(string, sizeof(string),"%S Has Died",GetPlayerName(playerid));
SendPlayerMessageToAll(string);
hmm, pawno is capital sensitive, replace %S with %s, maybe that is the problem;
it could be, because problems excist from the smallest things;


Re: Simple Death Message - harly - 06.03.2009

Код:
new name[ 24 ], string[ 64 ];
GetPlayerName( playerid, name, 24 );
format( string, sizeof(string), "~w~%s has been ownt", name );
GameTextForAll( string, 5000, 3 );



Re: Simple Death Message - kaisersouse - 06.03.2009

Quote:
Originally Posted by harly
Код:
new name[ 24 ], string[ 64 ];
GetPlayerName( playerid, name, 24 );
format( string, sizeof(string), "~w~%s has been ownt", name );
GameTextForAll( string, 5000, 3 );
That should be put under OnPlayerDeath by the way. If you only want to show it when a player kills another player...put it between:
Код:
if(killerid != INVALID_PLAYER_ID) {
  // put that other stuff here
}
Otherwise you'll have legions of retards all typing /kill to get their name on the screen, and also fill the screen with garbage for the purpose of ruining it for everyone else



Re: Simple Death Message - Alec24 - 06.03.2009

Is it possible to use the SendClientMessageToAll instead of GameTextForAll so it will just appear in the chat box.

If yes, should it be SendClientMessageToAll or SendPlayerMessageToAll?

Edit:It is all working fine now, Thanks to all.