OnPlayerDeath Help!
#1

Hello!

Is here anything wrong?

Code:

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
SendDeathMessage(killeridplayeridreason); 
    if(
killerid != INVALID_PLAYER_ID
    {
        
        
SetPlayerScore(killerid, +1);
        
PLAYER_CASH[killerid] += 100;
        
GivePlayerMoney(killerid100);
    }
    
PLAYER_DEATHS[playerid]++;
    
PLAYER_CASH[playerid] -= 100;
    
PLAYER_KILLS[killerid]++;
    
PLAYER_SCORE[killerid]++;
    return 
1;

Thanks for your help
Reply
#2

Yeah, you're setting the killer's score to 1. The '+' doesn't make any difference, it only shows that it's a positive number.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);  

    if(killerid != INVALID_PLAYER_ID)  
    {
         
        SetPlayerScore(killerid, GetPlayerScore(killerid)+1);

        PLAYER_CASH[killerid] += 100;
        GivePlayerMoney(killerid, 100);
    }
    PLAYER_DEATHS[playerid]++;
    PLAYER_CASH[playerid] -= 100;
    PLAYER_KILLS[killerid]++;
    PLAYER_SCORE[killerid]++;
    return 1;
}
Reply
#3

You're also not setting the playerid's cash like you are killerids. Not sure if intended like that or not
Reply
#4

I get this errors:

Quote:

C:\Users\tadej\Desktop\SA-MP Server\gamemodes\New.pwn(283) : error 028: invalid subscript (not an array or too many subscripts): "PLAYER_MONEY"
C:\Users\tadej\Desktop\SA-MP Server\gamemodes\New.pwn(283) : warning 215: expression has no effect
C:\Users\tadej\Desktop\SA-MP Server\gamemodes\New.pwn(283) : error 001: expected token: ";", but found "]"
C:\Users\tadej\Desktop\SA-MP Server\gamemodes\New.pwn(283) : error 029: invalid expression, assumed zero
C:\Users\tadej\Desktop\SA-MP Server\gamemodes\New.pwn(283) : 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
#5

Quote:
Originally Posted by Areax
Посмотреть сообщение
I get this errors:
I figured as much

Can you show us the declarations of those arrays?
Reply
#6

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
SendDeathMessage(killeridplayeridreason);
    if(
killerid != INVALID_PLAYER_ID)
    {
        
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
        
GivePlayerMoney(killerid100);
    }
    
PLAYER_DEATHS[playerid]++;
    
PLAYER_MONEY[playerid] -= 100;
    
PLAYER_KILLS[killerid]++;
    
PLAYER_SCORE[killerid]++;
    
PLAYER_MONEY[killerid]++= 100;
    return 
1;

Reply
#7

Quote:
Originally Posted by Areax
Посмотреть сообщение
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
SendDeathMessage(killeridplayeridreason);
    if(
killerid != INVALID_PLAYER_ID)
    {
        
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
        
GivePlayerMoney(killerid100);
    }
    
PLAYER_DEATHS[playerid]++;
    
PLAYER_MONEY[playerid] -= 100;
    
PLAYER_KILLS[killerid]++;
    
PLAYER_SCORE[killerid]++;
    
PLAYER_MONEY[killerid]++= 100;
    return 
1;

That's the implementation of the variables, not their declaration.
He means, show us where you define the variables (new PLAYER_DEATHS...)
Reply
#8

pawn Код:
PLAYER_MONEY[killerid]+= 100;
Reply
#9

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
That's the implementation of the variables, not their declaration.
He means, show us where you define the variables (new PLAYER_DEATHS...)
If you mean enums...

PHP код:
enum PLAYER_MAIN
{
     
PLAYER_NAME[MAX_PLAYER_NAME],
     
PLAYER_IP[16],
     
PLAYER_REGGED,
     
PLAYER_PASS,
     
PLAYER_LEVEL,
     
PLAYER_MONEY,
     
PLAYER_SCORE,
     
PLAYER_MUTED,
     
PLAYER_MUTE_TIME,
     
PLAYER_KILLS,
     
PLAYER_DEATHS 
Reply
#10

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);

    if(killerid != INVALID_PLAYER_ID)
    {

        SetPlayerScore(killerid, GetPlayerScore(killerid)+1);

        GivePlayerMoney(killerid, 100);
    }
    gPlayerInfo[playerid][PLAYER_DEATHS]++;
    gPlayerInfo[playerid][PLAYER_MONEY] -= 100;
    gPlayerInfo[killerid][PLAYER_KILLS]++;
    gPlayerInfo[killerid][PLAYER_SCORE]++;
    gPlayerInfo[killerid][PLAYER_MONEY]+= 100;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)