SA-MP Forums Archive
Pvar wont increase. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Pvar wont increase. (/showthread.php?tid=558591)



Pvar wont increase. - Prokill911 - 18.01.2015

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.


Re: Pvar wont increase. - Lynn - 18.01.2015

pawn Код:
#define PVarInt(%1,%2)++; SetPVarInt(%1,%2,GetPVarInt(%1,%2) + 1);
pawn Код:
PVarInt(playerid,"variable")++;
Credit to : cessil

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


Re: Pvar wont increase. - Prokill911 - 18.01.2015

Thanks,
Sry I did use ******, But It came up with no results that worked.

I'll give this a shot an then edit post


Re: Pvar wont increase. - Prokill911 - 18.01.2015

Edit: Got it working, But now my fricking Wounded state dont trigger...
God pawno hates me