PDA

View Full Version : Pvar wont increase.


Prokill911
18/01/2015, 03:09 AM
Hello,
Basically I am trying to increase Pvar "TimesShot" when ever someone is shot.
Here is my code

doWepDamage(damagedid, Float:amount, wepid) {
new Float:health;
new Float:armour;
GetPlayerHealth(damagedid, health);
GetPlayerArmour(damagedid, armour);
if(armour > 1 && armour <= MAX_ARMOUR) {
SetPlayerArmourEx(damagedid, armour-amount);
} else {
SetPlayerArmourEx(damagedid, 0);
SetPlayerHealthEx(damagedid, health-amount);
}
tryToApplyHurt(damagedid, health);
dropPlayerFromBike(damagedid, wepid);
new beenshot = 1;
new shotamount = GetPVarInt(damagedid, "TimesShot");
new gotshot = SetPVarInt(damagedid, "TimesShot", ++beenshot);
if(shotamount < 10) {
gotshot++;
SendClientMessage(damagedid, X11_TOMATO_2, "You have been shot!");
} else {
}
wobbleScreenForPlayer(damagedid, 500, 64000); //clientid, time in ms, drunkLevelamount
return 1;
}
When they spawn I have their pvar set to 0

So it should read

GetPVarInt(damagedid "TimesShot") This Var = 0
So after my if statement.... It should ADD +1 to the pvar, So example

If Pvar = 0 - After the if statement it = 1
And just keeps going until it reaches 10.

Any help would be nice.

Lynn
18/01/2015, 03:44 AM
#define PVarInt(%1,%2)++; SetPVarInt(%1,%2,GetPVarInt(%1,%2) + 1);


PVarInt(playerid,"variable")++;

Credit to : cessil

Next time use search...I found it in 1 second.

Prokill911
18/01/2015, 03:49 AM
Thanks,
Sry I did use ******, But It came up with no results that worked.

I'll give this a shot an then edit post

Prokill911
18/01/2015, 04:17 AM
Edit: Got it working, But now my fricking Wounded state dont trigger...
God pawno hates me