Erro onplayertakedamage
#1

Esta dando erro ao compilar codigo :
PHP код:
public OnPlayerTakeDamage( playerid, issuerid, Float:amount, weaponid )
{
    if ( 
playerData[ playerid ][ P_SYNCING ] )
        return 
true
    
new
        
Float:health,
        
Float:damage
    
;
    
GetPlayerHealth( playerid, health );
    
damage = ( amount > health ? health : amount );
    if ( 
issuerid != INVALID_PLAYER_ID )
    {
        if ( 
playerData[ issuerid ][ P_PLAYING ] )
        {
            if ( 
playerData[ issuerid ][ P_TEAM ] == playerData[ playerid ][ P_TEAM ] )
                return 
true;
            
roundData[ playerData[ issuerid ][ P_SLOT ] ][ playerData[ issuerid ][ P_TEAM ] ][ playerDamage ] += damage;
            
teamData[ playerData[ issuerid ][ P_TEAM ] ][ TEAM_DAMAGE ] += damage;
            if ( 
serverData[ cw_enabled ] )
                
playerData[ issuerid ][ P_TOTAL_DMG ] += damage;
            
update_infoTxt( issuerid );
        }
        
damageHit[ issuerid ][ playerid ][ 0 ] += damage;
        
damageHit[ playerid ][ issuerid ][ 1 ] += damage;
        
// doing_damage
        
if ( playerid != playerData[ issuerid ][ P_LAST_HIT ][ 0 ] )
        {
            switch ( 
playerData[ issuerid ][ P_HIT_ROWS ][ 0 ] )
            {
                case 
0:
                {
                    
format( damageStr[ issuerid ][ 0 ], 128, "%s (%s) -%i", playerName( playerid ), weaponNames[ weaponid ], floatround( damageHit[ issuerid ][ playerid ][ 0 ] ) );
                    
playerData[ issuerid ][ P_HIT_ROWS ][ 0 ] ++;
                }
                case 
1:
                {
                    
format( damageStr[ issuerid ][ 0 ], 128, "%s (%s) -%i~n~%s", playerName( playerid ), weaponNames[ weaponid ], floatround( damageHit[ issuerid ][ playerid ][ 0 ] ), damageStr[ issuerid ][ 0 ] );
                    
playerData[ issuerid ][ P_HIT_ROWS ][ 0 ] ++;
                }
                case 
2:
                {
                    if ( 
strfind( damageStr[ issuerid ][ 0 ], playerName( playerid ), true ) != -1 )
                    {
                        new 
ref[ 64 ];
                        
strmid( ref, damageStr[ issuerid ][ 0 ], 0, strfind( damageStr[ issuerid ][ 0 ], "~n~", true ) );
                        
format( damageStr[ issuerid ][ 0 ], 128, "%s (%s) -%i~n~%s", playerName( playerid ), weaponNames[ weaponid ], floatround( damageHit[ issuerid ][ playerid ][ 0 ] ), ref );
                    }
                    else
                    {
                         
format( damageStr[ issuerid ][ 0 ], 128, "%s (%s) -%i~n~%s", playerName( playerid ), weaponNames[ weaponid ], floatround( damageHit[ issuerid ][ playerid ][ 0 ] ), damageStr[ issuerid ][ 0 ] );
                        
playerData[ issuerid ][ P_HIT_ROWS ][ 0 ] ++;
                    }
                }
                case 
3:
                {
                    new 
len, ref[ 64 ];
                    
len = strfind( damageStr[ issuerid ][ 0 ], "~n~", true );
                    
strmid( ref, damageStr[ issuerid ][ 0 ], 0, strfind( damageStr[ issuerid ][ 0 ], "~n~", true, len + 3 ) );
                    
format( damageStr[ issuerid ][ 0 ], 128, "%s (%s) -%i~n~%s", playerName( playerid ), weaponNames[ weaponid ], floatround( damageHit[ issuerid ][ playerid ][ 0 ] ), ref );
                }
            }
            
playerData[ issuerid ][ P_LAST_HIT ][ 0 ] = playerid;
        }
        else
        {
            new 
len, ref[ 64 ];
            
len = strfind( damageStr[ issuerid ][ 0 ], "~n~", true );
            if ( 
len != -1 )
                
strmid( ref, damageStr[ issuerid ][ 0 ], len + 3, strlen( damageStr[ issuerid ][ 0 ] ) );
            if ( !
isnull( ref ) )
                
format( damageStr[ issuerid ][ 0 ], 128, "%s (%s) -%i~n~%s", playerName( playerid ), weaponNames[ weaponid ], floatround( damageHit[ issuerid ][ playerid ][ 0 ] ), ref );
            else
                
format( damageStr[ issuerid ][ 0 ], 128, "%s (%s) -%i", playerName( playerid ), weaponNames[ weaponid ], floatround( damageHit[ issuerid ][ playerid ][ 0 ] ) );
        }
        
PlayerTextDrawSetString( issuerid, damageText[ issuerid ][ 0 ], damageStr[ issuerid ][ 0 ] );
        
PlayerTextDrawShow( issuerid, damageText[ issuerid ][ 0 ] );
          
loopPlayers( otherid )
        {
             if ( 
GetPlayerState( otherid ) == PLAYER_STATE_SPECTATING && playerData[ otherid ][ P_SPECTATING ] == issuerid )
            {
                
PlayerTextDrawSetString( otherid, damageText[ otherid ][ 0 ], damageStr[ issuerid ][ 0 ] );
                
PlayerTextDrawShow( otherid, damageText[ otherid ][ 0 ] );
                
playerData[ otherid ][ P_DAMAGE_INDEX ][ 0 ] = 5;
                
PlayerPlaySound( otherid, 17802, 0, 0, 0 );
            }
        }
        
// getting_damage
        
if ( issuerid != playerData[ playerid ][ P_LAST_HIT ][ 1 ] )
        {
            switch ( 
playerData[ playerid ][ P_HIT_ROWS ][ 1 ] )
            {
                case 
0:
                {
                    
format( damageStr[ playerid ][ 1 ], 128, "%s (%s) -%i", playerName( issuerid ), weaponNames[ weaponid ], floatround( damageHit[ playerid ][ issuerid ][ 1 ] ) );
                    
playerData[ playerid ][ P_HIT_ROWS ][ 1 ] ++;
                }
                case 
1:
                {
                    
format( damageStr[ playerid ][ 1 ], 128, "%s (%s) -%i~n~%s", playerName( issuerid ), weaponNames[ weaponid ], floatround( damageHit[ playerid ][ issuerid ][ 1 ] ), damageStr[ playerid ][ 1 ] );
                    
playerData[ playerid ][ P_HIT_ROWS ][ 1 ] ++;
                }
                case 
2:
                {
                    if ( 
strfind( damageStr[ playerid ][ 1 ], playerName( issuerid ), true ) != -1 )
                    {
                        new 
ref[ 64 ];
                        
strmid( ref, damageStr[ playerid ][ 1 ], 0, strfind( damageStr[ playerid ][ 1 ], "~n~", true ) );
                        
format( damageStr[ playerid ][ 1 ], 128, "%s (%s) -%i~n~%s", playerName( issuerid ), weaponNames[ weaponid ], floatround( damageHit[ playerid ][ issuerid ][ 1 ] ), ref );
                    }
                    else
                    {
                         
format( damageStr[ playerid ][ 1 ], 128, "%s (%s) -%i~n~%s", playerName( issuerid ), weaponNames[ weaponid ], floatround( damageHit[ playerid ][ issuerid ][ 1 ] ), damageStr[ playerid ][ 1 ] );
                        
playerData[ playerid ][ P_HIT_ROWS ][ 1 ] ++;
                    }
                }
                case 
3:
                {
                    new 
len, ref[ 64 ];
                    
len = strfind( damageStr[ playerid ][ 1 ], "~n~", true );
                    
strmid( ref, damageStr[ playerid ][ 1 ], 0, strfind( damageStr[ playerid ][ 1 ], "~n~", true, len + 3 ) );
                    
format( damageStr[ playerid ][ 1 ], 128, "%s (%s) -%i~n~%s", playerName( issuerid ), weaponNames[ weaponid ], floatround( damageHit[ playerid ][ issuerid ][ 1 ] ), ref );
                }
            }
            
playerData[ playerid ][ P_LAST_HIT ][ 1 ] = issuerid;
        }
        else
        {
            new 
len, ref[ 64 ];
            
len = strfind( damageStr[ playerid ][ 1 ], "~n~", true );
            if ( 
len != -1 )
                
strmid( ref, damageStr[ playerid ][ 1 ], len + 3, strlen( damageStr[ playerid ][ 1 ] ) );
            if ( !
isnull( ref ) )
                
format( damageStr[ playerid ][ 1 ], 128, "%s (%s) -%i~n~%s", playerName( issuerid ), weaponNames[ weaponid ], floatround( damageHit[ playerid ][ issuerid ][ 1 ] ), ref );
            else
                
format( damageStr[ playerid ][ 1 ], 128, "%s (%s) -%i", playerName( issuerid ), weaponNames[ weaponid ], floatround( damageHit[ playerid ][ issuerid ][ 1 ] ) );
        }
        
PlayerTextDrawSetString( playerid, damageText[ playerid ][ 1 ], damageStr[ playerid ][ 1 ] );
        
PlayerTextDrawShow( playerid, damageText[ playerid ][ 1 ] );
          
loopPlayers( otherid )
        {
             if ( 
GetPlayerState( otherid ) == PLAYER_STATE_SPECTATING && playerData[ otherid ][ P_SPECTATING ] == playerid )
            {
                
PlayerTextDrawSetString( otherid, damageText[ otherid ][ 1 ], damageStr[ playerid ][ 1 ] );
                
PlayerTextDrawShow( otherid, damageText[ otherid ][ 1 ] );
                
playerData[ otherid ][ P_DAMAGE_INDEX ][ 1 ] = 5;
                
PlayerPlaySound( otherid, 1131, 0, 0, 0 );
            }
        }
        
playerData[ issuerid ][ P_DAMAGE_INDEX ][ 0 ] = 5;
        
playerData[ playerid ][ P_DAMAGE_INDEX ][ 1 ] = 5;
        
PlayerPlaySound( issuerid, 17802, 0, 0, 0 );
        
PlayerPlaySound( playerid, 1131,  0, 0, 0 );
    }
    if ( 
serverData[ started ] )
    {
        if ( 
playerData[ playerid ][ P_PLAYING ] )
        {
            new 
slot = findBarSlot( playerid, playerData[ playerid ][ P_TEAM ] );
            
setBarValue( playerData[ playerid ][ P_TEAM ], slot, ( barValue[ playerData[ playerid ][ P_TEAM ] ][ slot ] - damage ) );
            
loopPlayers( otherid )
            {
                if ( 
playerData[ otherid ][ P_CLASS ] == -1 )
                    
TextDrawShowForPlayer( otherid, hpBar[ playerData[ playerid ][ P_TEAM ] ][ slot ][ 1 ] );
            }
            if ( 
serverData[ modetype ] == BASE || serverData[ modetype ] == ARENA )
            {
                if ( 
teamData[ playerData[ playerid ][ P_TEAM ] ][ TEAM_DMG_INDEX ] ) teamData[ playerData[ playerid ][ P_TEAM ] ][ TEAM_DMG_COMBO ] += damage;
                else                                                                  
teamData[ playerData[ playerid ][ P_TEAM ] ][ TEAM_DMG_COMBO ]  = damage;
                
teamData[ playerData[ playerid ][ P_TEAM ] ][ TEAM_DMG_INDEX ] = 4;
                
teamData[ playerData[ playerid ][ P_TEAM ] ][ TEAM_HEALTH ] -= damage;
                new 
dmgStr[ 16 ];
                
format( dmgStr, sizeof( dmgStr ), "%s~h~~h~-%i", teamTxt( playerData[ playerid ][ P_TEAM ] ), floatround( teamData[ playerData[ playerid ][ P_TEAM ] ][ TEAM_DMG_COMBO ] ) );
                
TextDrawSetString( textDraws[ teamDamage ][ playerData[ playerid ][ P_TEAM ] ], dmgStr );
            }
        }
    }
    return 
true;
} 
Erros :
PHP код:
C:\Users\User\Desktop\hard.pwn(848) : error 017: undefined symbol "playerData"
C:\Users\User\Desktop\hard.pwn(848) : warning 215: expression has no effect
C
:\Users\User\Desktop\hard.pwn(848) : error 001: expected token: ";", but found "]"
C:\Users\User\Desktop\hard.pwn(848) : error 029: invalid expression, assumed zero
C
:\Users\User\Desktop\hard.pwn(848) : fatal error 107: too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase
4 Errors
. 
Reply
#2

You obviously did take this from somewhere else thus it says you have no variable set 'playerData'. Assuming it's the array that holds all the player data, you need to create one yourself.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)