Playerdamge Problem
#1

I want if player shot a player first time so he get wanted lvl 3 msg and 2nd time shoot again with wanted lvl 3 so get wanted lvl 6 star msg, if he don't have a star so he get again wanted lvl 3 hope u understand me or don't so pls ask to me for explain.

Код:
if(GetTeam{playerid} == CLASS_CIV && IsPlayerHoldingAGun(playerid) == 1)
	{
		shotsfired[playerid] ++;
		if(shotsfired[playerid] >= 25)
		{
			new current_zone, string[150];
			current_zone = Player_Zone[playerid];
			SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 3);
			format(string, sizeof(string), "%s [%d] has assaulted %s [%d] with a deadly weapon at %s", GetName(playerid), playerid, GetName(damagedid), damagedid, ZoneNames[current_zone][zone_name]);
			CopRadio(BLUE, string);
			SendClientMessage(playerid, RED, "Assault With A Deadly Weapon - Wanted Level 3");
			shotsfired[playerid] = 0;
		}
		else
        {
            new current_zone, string[150];
			current_zone = Player_Zone[playerid];
			SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 6);
			format(string, sizeof(string), "%s [%d] has assaulted %s [%d] with a deadly weapon at %s", GetName(playerid), playerid, GetName(damagedid), damagedid, ZoneNames[current_zone][zone_name]);
			CopRadio(BLUE, string);
			SendClientMessage(playerid, RED, "Assault With A Deadly Weapon - Wanted Level 6");
			shotsfired[playerid] = 0;
		}
	}
    return 1;
}
Reply
#2

So you want..
If a player shot another player the player who fired to have Wanted Level 3, else if he shot a player for the second time to have Wanted Level 6?
If yes, here's the code:
pawn Код:
if(GetTeam{playerid} == CLASS_CIV && IsPlayerHoldingAGun(playerid) == 1)
{
    shotsfired[playerid] =+ 1;
    if(shotsfired[playerid] == 1 && shotsfired[playerid] != 0)
    {
        new current_zone, string[150];
        current_zone = Player_Zone[playerid];
        SetPlayerWantedLevel(playerid, 3);
        format(string, sizeof(string), "%s [%d] has assaulted %s [%d] with a deadly weapon at %s", GetName(playerid), playerid, GetName(damagedid), damagedid, ZoneNames[current_zone][zone_name]);
        CopRadio(BLUE, string);
        SendClientMessage(playerid, RED, "Assault With A Deadly Weapon - Wanted Level 3");
        shotsfired[playerid] = 0;
    }
    else
    {
        new current_zone, string[150];
        current_zone = Player_Zone[playerid];
        SetPlayerWantedLevel(playerid, 6);
        format(string, sizeof(string), "%s [%d] has assaulted %s [%d] with a deadly weapon at %s", GetName(playerid), playerid, GetName(damagedid), damagedid, ZoneNames[current_zone][zone_name]);
        CopRadio(BLUE, string);
        SendClientMessage(playerid, RED, "Assault With A Deadly Weapon - Wanted Level 6");
        shotsfired[playerid] = 0;
    }
}
EDIT: You could use this Include: https://sampforum.blast.hk/showthread.php?pid=937824#pid937824
Reply
#3

E:\gtacnr\gamemodes\GTACNR2.pwn(18247) : error 029: invalid expression, assumed zero
E:\gtacnr\gamemodes\GTACNR2.pwn(18247) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


18247:
Quote:

shotsfired[playerid] =+ 1;

Reply
#4

E:\gtacnr\gamemodes\GTACNR2.pwn(18247) : error 029: invalid expression, assumed zero
E:\gtacnr\gamemodes\GTACNR2.pwn(18247) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


18247:
Quote:

shotsfired[playerid] =+ 1;

Reply
#5

It's "+=" not "=+"
Reply
#6

pawn Код:
shotsfired[playerid] += 1;
Reply
#7

Thanks! +rep a small mistake but i can't solve it. learning pawno.
Reply
#8

now working man they just show me only this: SendClientMessage(playerid, RED, "Assault With A Deadly Weapon - Wanted Level 3"); even i shot 2nd time with 3 star.
Reply
#9

Then just use the Include and I'll rewrite the code above
Reply
#10

still same error only got wanted lvl 3 msg
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)