Sometimes it does, sometimes it doesn't. This is the code:
Code:
new String:WeaponChance[25][] = {"weapon_knife", "weapon_glock", "weapon_usp", "weapon_p228", "weapon_deagle", "weapon_elite", "weapon_fiveseven", "weapon_m3", "weapon_xm1014", "weapon_galil", "weapon_ak47", "weapon_scout", "weapon_sg552", "weapon_awp", "weapon_g3sg1", "weapon_famas", "weapon_m4a1", "weapon_aug", "weapon_sg550", "weapon_mac10", "weapon_tmp", "weapon_mp5navy", "weapon_ump45", "weapon_p90", "weapon_m249"};
public GambleWeapons(client)
{
new skill_weps = War3_GetSkillLevel( client, thisRaceID, SKILL_WEPS );
weaponGive = GetRandomInt(0,(skill_weps*2));
new String:temp[64] = "weapon_knife,weapon_c4,";
StrCat(temp, 64, WeaponChance[weaponGive]);
War3_WeaponRestrictTo( client,thisRaceID, temp);
CreateTimer(2.5,giveWeapon,client);
PrintToChat(client, "\x04 This round you will use %s", WeaponChance[weaponGive]);
}
public Action:giveWeapon(Handle:timer,any:client)
{
GivePlayerItem( client, WeaponChance[weaponGive]);
}
public GambleWeapons(client)
{
new skill_weps = War3_GetSkillLevel( client, thisRaceID, SKILL_WEPS );
weaponGive = GetRandomInt(0,(skill_weps*2));
new String:temp[64] = "weapon_knife,weapon_c4,";
StrCat(temp, 64, WeaponChance[weaponGive]);
War3_WeaponRestrictTo( client,thisRaceID, temp);
CreateTimer(2.5,giveWeapon,client);
PrintToChat(client, "\x04 This round you will use %s", WeaponChance[weaponGive]);
}
public Action:giveWeapon(Handle:timer,any:client)
{
GivePlayerItem( client, WeaponChance[weaponGive]);
}
I'm not getting any errors, just sometimes it doesn't give the weapon... Any ideas appreciated! I thought putting the timer in before giving the wep would help, but it hasn't.




Logged





DarkEnergy