OnPlayerShootPlayer warnings
#1

So basically I'm getting these warnings, I'd appreciate if somebody helped me, cause I strongly suspect this is something easy to be fixed..





Code:
if(gTeam[Shooter] == 2)
{
if(!pEnchanted)
{
    new TargetName[MAX_PLAYER_NAME];
    new ShooterName[MAX_PLAYER_NAME];
    GetPlayerName(Target,TargetName,MAX_PLAYER_NAME);
    GetPlayerName(Shooter,ShooterName,MAX_PLAYER_NAME);
    new Float:health, Float:armour;
    GetPlayerHealth(Target,health);
    GetPlayerArmour(Target,armour);
    if(ArmourLost > 0.0) SetPlayerArmour(Target,floatadd(armour,ArmourLost));
    if(HealthLost > 0.0) SetPlayerHealth(Target,floatadd(health,HealthLost));
    new Damage;
    switch(GetPlayerWeapon(Shooter)) {                   //case [weaponid]: Damage = [damage];
        case 0: Damage = 15;
        case 8: Damage = 20;
        case 4: Damage = 25;
    }
    armour = armour - Damage;
    if(armour < 0.0) {
        health += armour;                         //Health will decrease because armour is negative. (a + (-b) = a - b)
        if(health <= 0.0) {
            health = 0.0;
        }
        armour = 0.0;
    }
    SetPlayerHealth(Target, health);
    SetPlayerArmour(Target, armour);

}
	return 1;
}
else
{
if(gTeam[Shooter] == 2)
{

if(pEnchanted == 1)
{
    new TargetName[MAX_PLAYER_NAME];
    new ShooterName[MAX_PLAYER_NAME];
    GetPlayerName(Target,TargetName,MAX_PLAYER_NAME);
    GetPlayerName(Shooter,ShooterName,MAX_PLAYER_NAME);
    new Float:health, Float:armour;
    GetPlayerHealth(Target,health);
    GetPlayerArmour(Target,armour);
    if(ArmourLost > 0.0) SetPlayerArmour(Target,floatadd(armour,ArmourLost));
    if(HealthLost > 0.0) SetPlayerHealth(Target,floatadd(health,HealthLost));
    new Damage;
    switch(GetPlayerWeapon(Shooter)) {                   //case [weaponid]: Damage = [damage];
        case 0: Damage = 15;
        case 8: Damage = 45;
        case 4: Damage = 25;
    }
    armour = armour - Damage;
    if(armour < 0.0) {
        health += armour;                         //Health will decrease because armour is negative. (a + (-b) = a - b)
        if(health <= 0.0) {
            health = 0.0;
        }
        armour = 0.0;
    }
    SetPlayerHealth(Target, health);
    SetPlayerArmour(Target, armour);
}
}

}
    return 1;
Thanks.
Reply
#2

What warnings ?
P.S
Is this my weapon damage system ? ,
Reply
#3

I don't know just loaned a function from the Onplayershootplayer section and tried to see if I could change the damage without failing, I'll give you credits for it on the script


Code:

D:\SAMP Server\gamemodes\Vampires.pwn(2458) : warning 205: redundant code: constant expression is zero
D:\SAMP Server\gamemodes\Vampires.pwn(2494) : warning 213: tag mismatch
D:\SAMP Server\gamemodes\Vampires.pwn(2494) : warning 205: redundant code: constant expression is zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Right, I forgot these..
Reply
#4

Well, sure, but what lines ?
Reply
#5

if(pEnchanted == 1)

And the other one, the straight opposite, the zero one.

if(!pEnchanted)

I mean by that.
Reply
#6

What does variable ' Enchanted ' means ?
Reply
#7

I have in in my player enum, therefore pEnchanted, if the player does not have it, they do significantly less damage, if they have it it increases immensely.
Reply
#8

Try using auto-ident tool all over your script and paste the code again.
Reply
#9

I'm very certain that, that wouldn't do anything and when I tried it anyhow it fucked up the whole thing..

Got it back as it was before, but I had to do loads in order to do that.

Thanks for the help but I think there is something else wrong here.
Reply
#10

Means you fucked up something when editing the damage system.
Reply
#11

No, it worked until I added pEnchanted, and it still does. It just gives me warnings I don't want.
Reply
#12

Quote:
Originally Posted by Andregood
View Post
No, it worked until I added pEnchanted, and it still does. It just gives me warnings I don't want.
It should be pInfo[playerid][pEnchanted] or something like that.
Could you show us your enum, where pEnchanted is defined?
Reply
#13

Well I got this right now;
Code:
if(PlayerInfo[playerid][pEnchanted] == 0)
But from what I understand the OnplayerShootplayer callback doesn't support playerid, and therefore I also get an error.



Code:
D:\SAMP Server\gamemodes\Vampires.pwn(2457) : error 017: undefined symbol "playerid"
Reply
#14

I guess you want to use Target instead of playerid.
Reply
#15

Omg, lol, you're right *facepalms*, sorry for that:P


Thanks for all the help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)