Wl problem
#1

Hi guys.
I have problem. This lines of code is in OnPlayerDeath and i think everything works except this if. I
tried and getplayerwantedlevel and setplayerwanted level but that didnt work...
This lines of code work like this.
If you die with wantedlevel you lose wanted level and cash*wantedlevel and wanted level need to be set on 0!
But its not working and no showing SCMF!
Can you help me? Thanks
Код:
////////////////////////////////////////////////////////////
	if(PlayerInfo[playerid][pTrazeniLevel] > 0)
	{
	    new string[256];
		g_NovacMinus(playerid, PlayerInfo[playerid][pTrazeniLevel]*3000);
		SCMF(playerid, -1, ""ZUTA"[INFO] "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", PlayerInfo[playerid][pTrazeniLevel]*3000, PlayerInfo[playerid][pTrazeniLevel]);
	    PlayerInfo[playerid][pTrazeniLevel] = 0;
		format(string,sizeof(string),""CRVENA"[GA:RP] "BELA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
		CFBIPD(-1, string);
		SetPlayerColor(playerid, BELA2);
    }
    ////////////////////////////////////////////////////////////
Reply
#2

Are you use [pTrazeniLevel] when you give wanted level? And can you show that code. Like example

PlayerInfo[killerid][pTrazeniLevel]++; ?
Reply
#3

This is for wl+++
Код:
 
stock PostaviWanted(playerid, zlocin[], prijavio[], wl)
{
	if(IsPlayerConnected(playerid))
	{
        PlayerInfo[playerid][pTrazeniLevel] += wl;
		if(GetPlayerWantedLevel(playerid) > 1000) { PlayerInfo[playerid][pTrazeniLevel] = 1000; }
		new string[256];
		format(string, sizeof(string), ""BELA"- Pocinili ste zlocin: "CRVENA"%s "BELA"| Prijava od: "CRVENA"%s!", zlocin, prijavio);
		SCM(playerid, -1, string);
		format(string, sizeof(string), ""BELA"- Trenutni Wanted Level: "CRVENA"%d!", PlayerInfo[playerid][pTrazeniLevel]);
		SCM(playerid, -1, string);
		format(string, sizeof(string), ""BELA"- Imamo novi prijavljen zlocin od: "CRVENA"%s!", prijavio);
		CFBIPD(-1, string);
		format(string, sizeof(string), ""BELA"- Pocinio: "CRVENA"%s | Zlocin: "CRVENA"%s | Wanted Level Pocinioca: "CRVENA"%d!", GetName(playerid),zlocin,PlayerInfo[playerid][pTrazeniLevel]);
		CFBIPD(-1, string);
		strmid(ZlocinInfo[playerid][zPrijavio], prijavio, 0, strlen(prijavio), 255);
		strmid(ZlocinInfo[playerid][zPocinio], GetName(playerid), 0, strlen(GetName(playerid)), 255);
		strmid(ZlocinInfo[playerid][zZlocin], zlocin, 0, strlen(zlocin), 255);
	}
	return 1;
}
Reply
#4

i tried when i have wl to die... and i am not lossing money and wl
Reply
#5

Show public we need whole OnPlayerDeath.
Reply
#6

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    JBC_SetPlayerArmour(playerid, 0);
    DisablePlayerCheckpoint(playerid);
    KillTimer(VuciTimer[playerid]);
	PosaoGPS[playerid] = 0;
	if(!Policajac(playerid))
	{
		new Float:Xx,Float:Yy,Float:Zz;
		GetPlayerPos(playerid, Xx, Yy, Zz);
		DropGun(playerid, GetPlayerWeapon(playerid),GetPlayerAmmo(playerid),Xx,Yy,Zz,GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
    }
	if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
		PlayerInfo[killerid][pUbistava]++; PlayerInfo[playerid][pSmrti]++;
		YokerResetPlayerWeapons(playerid); ResetujVar(playerid);
    }
	if(WarZapocet == 1)
	{
		if(PlayerInfo[playerid][pWar] == 1)
		{
			WarBrojanje2++;
			PlayerInfo[killerid][pTrazeniLevel] = 0;
			SetPlayerColor(killerid, BELA2);
			g_NovacPlus(playerid, 100);
		}
		else if(PlayerInfo[playerid][pWar] == 2)
		{
			WarBrojanje1++;
			PlayerInfo[killerid][pTrazeniLevel] = 0;
			SetPlayerColor(killerid, BELA2);
			g_NovacPlus(playerid, 100);
		}
	}
    ////////////////////////////////////////////////////////////
    if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
		if(IgracPolicajac(killerid))
		{
			PlayerInfo[killerid][pTrazeniLevel] = 0;
			SetPlayerColor(playerid, 0x2641FEAA);
		}
    }
	////////////////////////////////////////////////////////////
	if(!IgracPolicajac(killerid) && IsPlayerConnected(playerid))
	{
	    if(PlayerInfo[killerid][pWar] > 0) return 1;
		if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
		{
		
			PostaviWanted(killerid, "Ubistvo", "Nepoznat", 3);
		}
    }
	////////////////////////////////////////////////////////////
	if(PlayerInfo[killerid][pTrazeniLevel] > 1000)
	{
		PlayerInfo[killerid][pTrazeniLevel] = 1000;
	}
	if((!Policajac(killerid) && PlayerInfo[killerid][pUfbi] == 1) && Policajac(playerid))
    {
		new rand = random(sizeof(RandomZatvor));
		JBC_SetPlayerPos(killerid, RandomZatvor[rand][0], RandomZatvor[rand][1], RandomZatvor[rand][2]);
		SetPlayerInterior(killerid, 0);
		JBC_TogglePlayerControllable(killerid, 0);
		freeze[killerid] = SetTimerEx("Freeze",5000, false, "i", killerid);
		PlayerInfo[killerid][pZatvor] = 2;
		PlayerInfo[killerid][pZatvorenVreme] = 30*60;
		new string[256];
		format(string, sizeof(string), ""CRVENA"[GA:RP] Zatvoreni ste u zatvor na 30 minuta zbog SK!.");
		SCM(killerid, -1, string);
		format(string,sizeof(string), ""CRVENA"[GA:RP SK] "SIVA"Igrac %s (ID:%d) je uradio SK nad igracem %s (ID:%d) i zatvoren je na 30 minuta!", GetName(killerid), killerid, GetName(playerid), playerid);
	    AdminGameMaster(-1, string);
    }
	////////////////////////////////////////////////////////////
	if(PlayerInfo[playerid][pTrazeniLevel] > 0)
	{
	    new string[256];
		g_NovacMinus(playerid, PlayerInfo[playerid][pTrazeniLevel]*3000);
		SCMF(playerid, -1, ""ZUTA"[INFO] "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", PlayerInfo[playerid][pTrazeniLevel]*3000, PlayerInfo[playerid][pTrazeniLevel]);
	    PlayerInfo[playerid][pTrazeniLevel] = 0;
		format(string,sizeof(string),""CRVENA"[GA:RP] "BELA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
		CFBIPD(-1, string);
		SetPlayerColor(playerid, BELA2);
    }
    ////////////////////////////////////////////////////////////
	if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
	{
	    new string[256];
		format(string,sizeof(string), ""CRVENA"[GA:RP Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
	    AdminGameMaster(-1, string);
	    SetPlayerColor(killerid, COLOR_RED);
	}
	////////////////////////////////////////////////////////////
	if(IsPlayerConnected(killerid) && PlayerInfo[playerid][pLevel] >= 1)
	{
	    new string[256];
		format(string,sizeof(string), ""CRVENA"[GA:RP AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
		AdminGameMaster(-1, string);
		if(!Policajac(killerid))
		{
			SetPlayerColor(killerid, COLOR_RED);
		}
		if(PlayerInfo[playerid][pNarucen] == 1 && (PlayerInfo[killerid][pClan] == 10 || PlayerInfo[killerid][pLider] == 10))
		{
			g_NovacPlus(killerid, 17000);
			SCM(killerid,-1,""SPLAVA"[GA:RP]:"BELA"Ubili ste trazenog igraca i dobili 17 000 $!");
			PlayerInfo[killerid][pTrazeniLevel] = 0;
			SetPlayerColor(killerid, BELA2);
			PlayerInfo[playerid][pNarucen] = 0;
			format(string,sizeof(string),"[GA:RP] "ZUTA"Placeni ubica je ubio %s i izvrsio svoj zadatak!", GetName(playerid));
			SCMTA(-1,string);
		}
	}
	////////////////////////////////////////////////////////////
	if(gPlayerUsingLoopingAnim[playerid])
	{
		gPlayerUsingLoopingAnim[playerid] = 0;
	}
	
	if(InCP[playerid][Idlewood] == 1)
	{
    	KillTimer(g_timer[playerid][Idlewood]);
		KillTimer(CountTime[playerid]);
		UnderAttack[Idlewood] = 0;
	}
	if(InCP[playerid][Hospital] == 1)
	{
    	KillTimer(g_timer[playerid][Hospital]);
		KillTimer(CountTime[playerid]);
		UnderAttack[Hospital] = 0;
	}
	if(InCP[playerid][Ammunation] == 1)
	{
    	KillTimer(g_timer[playerid][Ammunation]);
		KillTimer(CountTime[playerid]);
		UnderAttack[Ammunation] = 0;
	}
	if(InCP[playerid][Stadium] == 1)
	{
	    KillTimer(g_timer[playerid][Stadium]);
		KillTimer(CountTime[playerid]);
		UnderAttack[Stadium] = 0;
	}
	////////////////////////////////////////////////////////////
	if(reason == 22)
	{
		if(PlayerInfo[killerid][pPistSkill] >= 0 && PlayerInfo[killerid][pPistSkill] <= 1000)
		{
		    PlayerInfo[killerid][pPistSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
	if(reason == 23)
	{
		if(PlayerInfo[killerid][pSilenSkill] >= 0 && PlayerInfo[killerid][pSilenSkill] <= 1000)
		{
		    PlayerInfo[killerid][pSilenSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
	if(reason == 24)
	{
		if(PlayerInfo[killerid][pDesertSkill] >= 0 && PlayerInfo[killerid][pDesertSkill] <= 1000)
		{
		    PlayerInfo[killerid][pDesertSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
	if(reason == 25)
	{
		if(PlayerInfo[killerid][pShotgSkill] >= 0 && PlayerInfo[killerid][pShotgSkill] <= 1000)
		{
		    PlayerInfo[killerid][pShotgSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
	if(reason == 26)
	{
		if(PlayerInfo[killerid][pSawnSkill] >= 0 && PlayerInfo[killerid][pSawnSkill] <= 800)
		{
		    PlayerInfo[killerid][pSawnSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
	if(reason == 27)
	{
		if(PlayerInfo[killerid][pCombSkill] >= 0 && PlayerInfo[killerid][pCombSkill] <= 1000)
		{
		    PlayerInfo[killerid][pCombSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}

	if(reason == 28 || reason == 32)
	{
		if(PlayerInfo[killerid][pUziSkill] >= 0 && PlayerInfo[killerid][pUziSkill] <= 800)
		{
		    PlayerInfo[killerid][pUziSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}

	if(reason == 29)
	{
		if(PlayerInfo[killerid][pSmgSkill] >= 0 && PlayerInfo[killerid][pSmgSkill] <= 1000)
		{
		    PlayerInfo[killerid][pSmgSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}

	if(reason == 30)
	{
		if(PlayerInfo[killerid][pAkSkill] >= 0 && PlayerInfo[killerid][pAkSkill] <= 1000)
		{
		    PlayerInfo[killerid][pAkSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}

	if(reason == 31)
	{
		if(PlayerInfo[killerid][pM4Skill] >= 0 && PlayerInfo[killerid][pM4Skill] <= 1000)
		{
		    PlayerInfo[killerid][pM4Skill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
    return 1;
}
Reply
#7

Just for debug try with this way, so let's see if that's working fine


Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    JBC_SetPlayerArmour(playerid, 0);
    DisablePlayerCheckpoint(playerid);
    KillTimer(VuciTimer[playerid]);
	PosaoGPS[playerid] = 0;
	if(!Policajac(playerid))
	{
		new Float:Xx,Float:Yy,Float:Zz;
		GetPlayerPos(playerid, Xx, Yy, Zz);
		DropGun(playerid, GetPlayerWeapon(playerid),GetPlayerAmmo(playerid),Xx,Yy,Zz,GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
    }
	if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
		PlayerInfo[killerid][pUbistava]++; PlayerInfo[playerid][pSmrti]++;
		YokerResetPlayerWeapons(playerid); ResetujVar(playerid);
    }
	if(WarZapocet == 1)
	{
		if(PlayerInfo[playerid][pWar] == 1)
		{
			WarBrojanje2++;
			PlayerInfo[killerid][pTrazeniLevel] = 0;
			SetPlayerColor(killerid, BELA2);
			g_NovacPlus(playerid, 100);
		}
		else if(PlayerInfo[playerid][pWar] == 2)
		{
			WarBrojanje1++;
			PlayerInfo[killerid][pTrazeniLevel] = 0;
			SetPlayerColor(killerid, BELA2);
			g_NovacPlus(playerid, 100);
		}
	}
    ////////////////////////////////////////////////////////////
    if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
		if(IgracPolicajac(killerid))
		{
			PlayerInfo[killerid][pTrazeniLevel] = 0;
			SetPlayerColor(playerid, 0x2641FEAA);
		}
    }
	////////////////////////////////////////////////////////////
	if(!IgracPolicajac(killerid) && IsPlayerConnected(playerid))
	{
	    if(PlayerInfo[killerid][pWar] > 0) return 1;
		if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
		{
		
			PostaviWanted(killerid, "Ubistvo", "Nepoznat", 3);
		}
    }
	////////////////////////////////////////////////////////////
	if(PlayerInfo[killerid][pTrazeniLevel] > 1000)
	{
		PlayerInfo[killerid][pTrazeniLevel] = 1000;
	}
	if((!Policajac(killerid) && PlayerInfo[killerid][pUfbi] == 1) && Policajac(playerid))
    {
		new rand = random(sizeof(RandomZatvor));
		JBC_SetPlayerPos(killerid, RandomZatvor[rand][0], RandomZatvor[rand][1], RandomZatvor[rand][2]);
		SetPlayerInterior(killerid, 0);
		JBC_TogglePlayerControllable(killerid, 0);
		freeze[killerid] = SetTimerEx("Freeze",5000, false, "i", killerid);
		PlayerInfo[killerid][pZatvor] = 2;
		PlayerInfo[killerid][pZatvorenVreme] = 30*60;
		new string[256];
		format(string, sizeof(string), ""CRVENA"[GA:RP] Zatvoreni ste u zatvor na 30 minuta zbog SK!.");
		SCM(killerid, -1, string);
		format(string,sizeof(string), ""CRVENA"[GA:RP SK] "SIVA"Igrac %s (ID:%d) je uradio SK nad igracem %s (ID:%d) i zatvoren je na 30 minuta!", GetName(killerid), killerid, GetName(playerid), playerid);
	    AdminGameMaster(-1, string);
    }
	////////////////////////////////////////////////////////////
        PlayerInfo[playerid][pTrazeniLevel] = 1; //DEBUG
        SCM(playerid, -1, "Setting pTrazeniLevel to 1");//DEBUG
	if(PlayerInfo[playerid][pTrazeniLevel] > 0)
	{
            SCM(playerid, -1, "Calling function");//DEBUG
	    new string[256];
		g_NovacMinus(playerid, PlayerInfo[playerid][pTrazeniLevel]*3000);
		SCMF(playerid, -1, ""ZUTA"[INFO] "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", PlayerInfo[playerid][pTrazeniLevel]*3000, PlayerInfo[playerid][pTrazeniLevel]);
	    PlayerInfo[playerid][pTrazeniLevel] = 0;
		format(string,sizeof(string),""CRVENA"[GA:RP] "BELA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
		CFBIPD(-1, string);
		SetPlayerColor(playerid, BELA2);
               SCM(playerid, -1, "End");//DEBUG
    }
    ////////////////////////////////////////////////////////////
	if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
	{
	    new string[256];
		format(string,sizeof(string), ""CRVENA"[GA:RP Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
	    AdminGameMaster(-1, string);
	    SetPlayerColor(killerid, COLOR_RED);
	}
	////////////////////////////////////////////////////////////
	if(IsPlayerConnected(killerid) && PlayerInfo[playerid][pLevel] >= 1)
	{
	    new string[256];
		format(string,sizeof(string), ""CRVENA"[GA:RP AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
		AdminGameMaster(-1, string);
		if(!Policajac(killerid))
		{
			SetPlayerColor(killerid, COLOR_RED);
		}
		if(PlayerInfo[playerid][pNarucen] == 1 && (PlayerInfo[killerid][pClan] == 10 || PlayerInfo[killerid][pLider] == 10))
		{
			g_NovacPlus(killerid, 17000);
			SCM(killerid,-1,""SPLAVA"[GA:RP]:"BELA"Ubili ste trazenog igraca i dobili 17 000 $!");
			PlayerInfo[killerid][pTrazeniLevel] = 0;
			SetPlayerColor(killerid, BELA2);
			PlayerInfo[playerid][pNarucen] = 0;
			format(string,sizeof(string),"[GA:RP] "ZUTA"Placeni ubica je ubio %s i izvrsio svoj zadatak!", GetName(playerid));
			SCMTA(-1,string);
		}
	}
	////////////////////////////////////////////////////////////
	if(gPlayerUsingLoopingAnim[playerid])
	{
		gPlayerUsingLoopingAnim[playerid] = 0;
	}
	
	if(InCP[playerid][Idlewood] == 1)
	{
    	KillTimer(g_timer[playerid][Idlewood]);
		KillTimer(CountTime[playerid]);
		UnderAttack[Idlewood] = 0;
	}
	if(InCP[playerid][Hospital] == 1)
	{
    	KillTimer(g_timer[playerid][Hospital]);
		KillTimer(CountTime[playerid]);
		UnderAttack[Hospital] = 0;
	}
	if(InCP[playerid][Ammunation] == 1)
	{
    	KillTimer(g_timer[playerid][Ammunation]);
		KillTimer(CountTime[playerid]);
		UnderAttack[Ammunation] = 0;
	}
	if(InCP[playerid][Stadium] == 1)
	{
	    KillTimer(g_timer[playerid][Stadium]);
		KillTimer(CountTime[playerid]);
		UnderAttack[Stadium] = 0;
	}
	////////////////////////////////////////////////////////////
	if(reason == 22)
	{
		if(PlayerInfo[killerid][pPistSkill] >= 0 && PlayerInfo[killerid][pPistSkill] <= 1000)
		{
		    PlayerInfo[killerid][pPistSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
	if(reason == 23)
	{
		if(PlayerInfo[killerid][pSilenSkill] >= 0 && PlayerInfo[killerid][pSilenSkill] <= 1000)
		{
		    PlayerInfo[killerid][pSilenSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
	if(reason == 24)
	{
		if(PlayerInfo[killerid][pDesertSkill] >= 0 && PlayerInfo[killerid][pDesertSkill] <= 1000)
		{
		    PlayerInfo[killerid][pDesertSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
	if(reason == 25)
	{
		if(PlayerInfo[killerid][pShotgSkill] >= 0 && PlayerInfo[killerid][pShotgSkill] <= 1000)
		{
		    PlayerInfo[killerid][pShotgSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
	if(reason == 26)
	{
		if(PlayerInfo[killerid][pSawnSkill] >= 0 && PlayerInfo[killerid][pSawnSkill] <= 800)
		{
		    PlayerInfo[killerid][pSawnSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
	if(reason == 27)
	{
		if(PlayerInfo[killerid][pCombSkill] >= 0 && PlayerInfo[killerid][pCombSkill] <= 1000)
		{
		    PlayerInfo[killerid][pCombSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}

	if(reason == 28 || reason == 32)
	{
		if(PlayerInfo[killerid][pUziSkill] >= 0 && PlayerInfo[killerid][pUziSkill] <= 800)
		{
		    PlayerInfo[killerid][pUziSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}

	if(reason == 29)
	{
		if(PlayerInfo[killerid][pSmgSkill] >= 0 && PlayerInfo[killerid][pSmgSkill] <= 1000)
		{
		    PlayerInfo[killerid][pSmgSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}

	if(reason == 30)
	{
		if(PlayerInfo[killerid][pAkSkill] >= 0 && PlayerInfo[killerid][pAkSkill] <= 1000)
		{
		    PlayerInfo[killerid][pAkSkill] += 2;
		    SetPlayerSkills(killerid);
		}
	}

	if(reason == 31)
	{
		if(PlayerInfo[killerid][pM4Skill] >= 0 && PlayerInfo[killerid][pM4Skill] <= 1000)
		{
		    PlayerInfo[killerid][pM4Skill] += 2;
		    SetPlayerSkills(killerid);
		}
	}
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)