OnPlayerTakeDamage - error
#1

I've this error with this code:
Code:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{

 if(issuerid != INVALID_PLAYER_ID && IsPlayerConnectedEx(issuerid))
 {

   if(tazer_out[issuerid])
  {

   if(GetPlayerWeapon(issuerid) == WEAPON_SILENCED)
   {

       if(GetDistanceBetweenPlayers(issuerid,playerid) < 10.0)
       {

        TazePlayer(issuerid,playerid);

    }

   }

  }

 }
 if(issuerid != INVALID_PLAYER_ID)
 {

     if(amount > 5.0 && weaponid != 0)
     {

         new Float:armor;
   GetPlayerArmour(playerid,armor);
   if(armor <= 0.0)
   {

          //TextDrawShowForPlayer(playerid,crash_screen);
          //SetTimerEx("HideCrash",250,0,"i",playerid);
          //SetPlayerDrunkLevel(playerid,(GetPlayerDrunkLevel(playerid) + 4000));

     }

     }

 }
 {
 if(issuerid == INVALID_PLAYER_ID) return 1;
 new Float:health,Float:armour;
 GetPlayerHealth(playerid,health);
 GetPlayerArmour(playerid,armour);
 new damage = 0;
 switch(weaponid)
 {
 case 22: damage = 58;
 }
 case 24: damage = 96;
 case 25:
 {
 if(amount < 45) damage = floatround(amount);
 else damage = 100 + floatround(amount);
 }
 case 27:
 {
 if(amount < 35) damage = floatround(amount);
 else damage = 100 + floatround(amount);
 }
 case 28: damage = 16;
 case 29: damage = 26;
 case 30: damage = 49;
 case 31: damage = 44;
 case 32: damage = 16;
 case 33: damage = 59;
 case 34: damage = 341;
 default: damage = floatround(amount);
}
}
C:\Users\Luca\Desktop\Server\rp.pwn(15257) : error 014: invalid statement; not in switch
C:\Users\Luca\Desktop\Server\rp.pwn(15257) : warning 215: expression has no effect
C:\Users\Luca\Desktop\Server\rp.pwn(15257) : error 001: expected token: ";", but found ":"
C:\Users\Luca\Desktop\Server\rp.pwn(15257) : error 029: invalid expression, assumed zero
C:\Users\Luca\Desktop\Server\rp.pwn(15257) : fatal error 107: too many error messages on one line
Reply
#2

Few braces with a different angle.
pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{

    if(issuerid != INVALID_PLAYER_ID && IsPlayerConnectedEx(issuerid))
    {
        if(tazer_out[issuerid])
        {
            if(GetPlayerWeapon(issuerid) == WEAPON_SILENCED)
            {
                if(GetDistanceBetweenPlayers(issuerid,playerid) < 10.0)
                {
                    TazePlayer(issuerid,playerid);
                }
            }
        }
    }
    if(issuerid != INVALID_PLAYER_ID)
    {
        if(amount > 5.0 && weaponid != 0)
        {
            new Float:armor;
            GetPlayerArmour(playerid,armor);
            if(armor <= 0.0)
            {
                //TextDrawShowForPlayer(playerid,crash_screen);
                //SetTimerEx("HideCrash",250,0,"i",playerid);
                //SetPlayerDrunkLevel(playerid,(GetPlayerDrunkLevel(playerid) + 4000));
            }
        }
    }
    if(issuerid == INVALID_PLAYER_ID) return 1;
    new Float:health,Float:armour;
    GetPlayerHealth(playerid,health);
    GetPlayerArmour(playerid,armour);
    new damage = 0;
    switch(weaponid)
    {
        case 22: damage = 58;
        case 24: damage = 96;
        case 25:
        {
            if(amount < 45) damage = floatround(amount);
            else damage = 100 + floatround(amount);
        }
        case 27:
        {
            if(amount < 35) damage = floatround(amount);
            else damage = 100 + floatround(amount);
        }
        case 28: damage = 16;
        case 29: damage = 26;
        case 30: damage = 49;
        case 31: damage = 44;
        case 32: damage = 16;
        case 33: damage = 59;
        case 34: damage = 341;
        default: damage = floatround(amount);
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Dwane
View Post
Few braces with a different angle.
pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{

    if(issuerid != INVALID_PLAYER_ID && IsPlayerConnectedEx(issuerid))
    {
        if(tazer_out[issuerid])
        {
            if(GetPlayerWeapon(issuerid) == WEAPON_SILENCED)
            {
                if(GetDistanceBetweenPlayers(issuerid,playerid) < 10.0)
                {
                    TazePlayer(issuerid,playerid);
                }
            }
        }
    }
    if(issuerid != INVALID_PLAYER_ID)
    {
        if(amount > 5.0 && weaponid != 0)
        {
            new Float:armor;
            GetPlayerArmour(playerid,armor);
            if(armor <= 0.0)
            {
                //TextDrawShowForPlayer(playerid,crash_screen);
                //SetTimerEx("HideCrash",250,0,"i",playerid);
                //SetPlayerDrunkLevel(playerid,(GetPlayerDrunkLevel(playerid) + 4000));
            }
        }
    }
    if(issuerid == INVALID_PLAYER_ID) return 1;
    new Float:health,Float:armour;
    GetPlayerHealth(playerid,health);
    GetPlayerArmour(playerid,armour);
    new damage = 0;
    switch(weaponid)
    {
        case 22: damage = 58;
        case 24: damage = 96;
        case 25:
        {
            if(amount < 45) damage = floatround(amount);
            else damage = 100 + floatround(amount);
        }
        case 27:
        {
            if(amount < 35) damage = floatround(amount);
            else damage = 100 + floatround(amount);
        }
        case 28: damage = 16;
        case 29: damage = 26;
        case 30: damage = 49;
        case 31: damage = 44;
        case 32: damage = 16;
        case 33: damage = 59;
        case 34: damage = 341;
        default: damage = floatround(amount);
    }
    return 1;
}
I've this warning:
PHP Code:
C:\Users\David\Desktop\rp.pwn(15300) : warning 204symbol is assigned a value that is never used"damage" 
Reply
#4

Quote:
Originally Posted by Davman
View Post
I've this warning:
PHP Code:
C:\Users\David\Desktop\rp.pwn(15300) : warning 204symbol is assigned a value that is never used"damage" 
Because nothing happends after you detect what gun does how much damage..
Reply
#5

Quote:
Originally Posted by dannyk0ed
View Post
Because nothing happends after you detect what gun does how much damage..
True.

You set a value to the "damage" variable and then do nothing.
Use it somewhere!
Reply
#6

Ah, and how could I do this? Could you post an example? I'm still a beginner with those kind of scripts.
Reply
#7

I don't know what do you want to do. Why did you calculate the "damage"? Use it for that!
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)