Level problem
There's a problem in my code and I can't find it, it has to level up correct guns level by xp but it doesn't.
PHP Code:
#define MAXKILLS 6
new ak47kills[33];
new m4a1kills[33];
new ump45kills[33];
new deaglekills[33];
new uspkills[33];
new grenadeHEkills[33];
new ak47xp[33];
new m4a1xp[33];
new ump45xp[33];
new deaglexp[33];
new uspxp[33];
new grenadeHExp[33];
/* [ Needed Kills for each guns ] */
new const ak47needed[MAXKILLS] =
{
50,
100,
200,
300,
350,
351
}
new const m4a1needed[MAXKILLS] =
{
50,
100,
200,
300,
350,
351
}
new const ump45needed[MAXKILLS] =
{
50,
100,
200,
300,
350,
351
}
new const deagleneeded[MAXKILLS] =
{
10,
50,
100,
150,
200,
201
}
new const uspneeded[MAXKILLS] =
{
10,
50,
100,
150,
200,
201
}
new const heneeded[MAXKILLS] =
{
3,
8,
15,
20,
25,
26
}
public eDeath1( )
{
new attacker = read_data( 1 )
new clip, ammo, weapon1 = get_user_weapon(attacker,clip,ammo);
if(weapon1 == CSW_AK47)
{
ak47xp[attacker] += 1
client_print(attacker, print_center, "You got 1 kill with ak47")
check_gun(attacker)
}
if(weapon1 == CSW_M4A1)
{
m4a1xp[attacker] += 1
client_print(attacker, print_center, "You got 1 kill with m4a1")
check_gun(attacker)
}
if(weapon1 == CSW_UMP45)
{
ump45xp[attacker] += 1
client_print(attacker, print_center, "You got 1 kill with ump45")
check_gun(attacker)
}
if(weapon1 == CSW_DEAGLE)
{
deaglexp[attacker] += 1
client_print(attacker, print_center, "You got 1 kill with deagle")
check_gun(attacker)
}
if(weapon1 == CSW_USP)
{
uspxp[attacker] += 1
client_print(attacker, print_center, "You got 1 kill with usp")
check_gun(attacker)
}
if(weapon1 == CSW_HEGRENADE)
{
grenadeHExp[attacker] += 1
client_print(attacker, print_center, "You got 1 kill with hegrenade")
check_gun(attacker)
}
}
public check_gun(id)
{
if(ak47kills[id] < MAXKILLS-1)
{
while(ak47xp[id] >= ak47needed[ak47kills[id]])
{
ak47kills[id]++;
client_print(id, print_chat, "[MW2]: Achieviment AK47 %s %i done!", namemaster[ak47kills[id]], ak47kills[id])
}
}
if(m4a1kills[id] < MAXKILLS-1)
{
while(m4a1xp[id] >= m4a1needed[m4a1kills[id]])
{
m4a1kills[id]++;
client_print(id, print_chat, "[MW2]: Achieviment M4a1 %s %i done!", namemaster[m4a1kills[id]], m4a1kills[id])
}
}
if(ump45kills[id] < MAXKILLS-1)
{
while(ump45xp[id] >= ump45needed[ump45kills[id]])
{
ump45kills[id]++;
client_print(id, print_chat, "[MW2]: Achieviment Ump45 %s %i done!", namemaster[ump45kills[id]], ump45kills[id])
}
}
if(deaglekills[id] < MAXKILLS-1)
{
while(deaglexp[id] >= deagleneeded[deaglekills[id]])
{
deaglekills[id]++;
client_print(id, print_chat, "[MW2]: Achieviment Deagle %s done!", namemaster[deaglekills[id]])
}
}
if(uspkills[id] < MAXKILLS-1)
{
while(uspxp[id] >= uspneeded[uspkills[id]])
{
uspkills[id]++;
client_print(id, print_chat, "[MW2]: Achieviment Usp %s done!", namemaster[uspkills[id]])
}
}
if(grenadeHEkills[id] < MAXKILLS-1)
{
while(grenadeHExp[id] >= heneeded[grenadeHEkills[id]])
{
grenadeHEkills[id]++;
client_print(id, print_chat, "[MW2]: Achieviment He-Grenade %s done!", namemaster[grenadeHEkills[id]])
}
}
}
|