OnPlayerShootPlayer warnings -
Andregood - 21.08.2011
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.
Re: OnPlayerShootPlayer warnings -
Darnell - 21.08.2011
What warnings ?
P.S
Is this my weapon damage system ?

,
Re: OnPlayerShootPlayer warnings -
Andregood - 21.08.2011
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..
Re: OnPlayerShootPlayer warnings -
Darnell - 21.08.2011
Well, sure, but what lines ?
Re: OnPlayerShootPlayer warnings -
Andregood - 21.08.2011
if(pEnchanted == 1)
And the other one, the straight opposite, the zero one.
if(!pEnchanted)
I mean by that.
Re: OnPlayerShootPlayer warnings -
Darnell - 21.08.2011
What does variable ' Enchanted ' means ?
Re: OnPlayerShootPlayer warnings -
Andregood - 21.08.2011
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.
Re: OnPlayerShootPlayer warnings -
Darnell - 21.08.2011
Try using
auto-ident tool all over your script and paste the code again.
Re: OnPlayerShootPlayer warnings -
Andregood - 21.08.2011
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.
Re: OnPlayerShootPlayer warnings -
Darnell - 21.08.2011
Means you fucked up something when editing the damage system.
Re: OnPlayerShootPlayer warnings -
Andregood - 21.08.2011
No, it worked until I added pEnchanted, and it still does. It just gives me warnings I don't want.
Re: OnPlayerShootPlayer warnings -
wups - 21.08.2011
Quote:
Originally Posted by Andregood
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?
Re: OnPlayerShootPlayer warnings -
Andregood - 21.08.2011
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"
Re: OnPlayerShootPlayer warnings -
woot - 21.08.2011
I guess you want to use Target instead of playerid.
Re: OnPlayerShootPlayer warnings -
Andregood - 21.08.2011
Omg, lol, you're right *facepalms*, sorry for that:P
Thanks for all the help