kill message
#1

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

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;

Reply
#3

Код:
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.
Reply
#4

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)