SA-MP Forums Archive
kill 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: kill message (/showthread.php?tid=274608)



kill message - Millionaire - 06.08.2011

hi i want a script like, if a player kill another player then it should show a message to all " %s has killed %s ( weapon name) .Can anyone help me plz


Re: kill message - WoodPecker - 06.08.2011

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    new 
name[MAX_PLAYER_NAME];
    new 
killer[MAX_PLAYER_NAME];
    new 
weapname[50];
    new 
string[50];
    
GetPlayerName(playeridnamesizeof(name));
    
GetPlayerName(killeridkillersizeof(killer));
    
GetWeaponName(GetPlayerWeapon(killerid), weapnamesizeof(weapname));
    
format(string,128,"%s has killed %s with a %s.",killer,name,weapname);
    
SendClientMessageToAll(COLOR_YELLOWstring);
    return 
1;




AW: kill message - samtey - 06.08.2011

Код:
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(483) : error 017: undefined symbol "name"
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(483) : error 017: undefined symbol "name"
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(483) : error 029: invalid expression, assumed zero
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(483) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: kill message - WoodPecker - 06.08.2011

Samtey im not getting any errors when i tested this one, can you post here your OnPlayerDeath please?


AW: kill message - samtey - 06.08.2011

I dunno, u probably defined the variables too late! I corrected my one into this:

PHP код:
 public OnPlayerDeath(playeridkilleridreason)
    {
    new 
name[MAX_PLAYER_NAME]; //brought it before the getplayer
    
new killer[MAX_PLAYER_NAME]; //brought it before the getplayer
    
new weapname[50]; //brought it before the getplayer
    
new string[128]; //defined a string
    
GetPlayerName(playeridnamesizeof(name));
    
GetPlayerName(killeridkillersizeof(killer));
    
GetWeaponName(GetPlayerWeapon(killerid), weapnamesizeof(weapname));
    
format(string,128,"%s has killed %s with a %s.",killer,name,weapname);
    
SendClientMessageToAll(COLOR_YELLOWstring); 



Re: kill message - WoodPecker - 06.08.2011

Ye i placed the GetPlayerName at the wrong place, i think now its working.