[Solved] Simple Death Message
#1

I just want a message to appear saying:

"<PlayerName> Has Died!"

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

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

Quote:

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

well I would use 28 :P
Reply
#4

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.
Reply
#5

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

otherwise we cant do anything lol
Reply
#6

It was just what maij told me

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

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

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

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

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)