Need help with a script lag... ASAP!
#1

So, Ive made this lil GM that i might post later...
But i have a problem....

pawn Код:
forward WeaponChange();
public WeaponChange()
{
//KillTimer(WeapTimer);
new randweap = random(sizeof(RandomWeapons));
CurrentWeaponId = RandomWeapons[randweap];
SetTimer("GiveTheCurrentWeapon",15000,false);
return 1;
}

forward GiveTheCurrentWeapon();
public GiveTheCurrentWeapon()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
//KillTimer(GiveTimer);
GameTextForAll("~r~Weapons Cycled",1500,5);
ResetPlayerWeapons(i);
GivePlayerWeapon(i,CurrentWeaponId,99999);
SetTimer("WeaponChange",30000,false);
}
return 1;
}
Everything works fine But the text "Weapons Cycled" appears 2 or 3 times for sum reason... o_0
and after a few cycles it starts to lag REALLY bad when its on my own PC...
Ive tried KillTimer... but no change....

The way i use this is below...

pawn Код:
new CurrentWeaponId;
pawn Код:
public OnPlayerSpawn(playerid)
{
GivePlayerWeapon(playerid,CurrentWeaponId,99999);
return 1;
}
Help needed ASAP!

Regards....

BTW you better not steal my idea!!!
Reply
#2

pawn Код:
forward WeaponChange();
public WeaponChange()
{
    new randweap = random(sizeof(RandomWeapons));
    CurrentWeaponId = RandomWeapons[randweap];
    GiveTheCurrentWeapon(); //removed the timer, why wait ?
}

forward GiveTheCurrentWeapon();
public GiveTheCurrentWeapon()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        ResetPlayerWeapons(i);
        GivePlayerWeapon(i,CurrentWeaponId,99999);
    }
    //You called the gamtext and the timer x (number of players) times
    //if that goes on you would have all 45 seconds double so much timers as before
    GameTextForAll("~r~Weapons Cycled",1500,5);
    SetTimer("WeaponChange",30000,false);
}
Reply
#3

Mate... just 3 words.... YOU ARE AWSOME!.... Thx a LOT!! i rly needed that!!!!!
Reply
#4

I've edited this post due misread
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)