Need help with a script lag... ASAP! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with a script lag... ASAP! (
/showthread.php?tid=229853)
Need help with a script lag... ASAP! -
[MNC]Azz - 22.02.2011
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 Код:
public OnPlayerSpawn(playerid)
{
GivePlayerWeapon(playerid,CurrentWeaponId,99999);
return 1;
}
Help needed ASAP!
Regards....
BTW you better not steal my idea!!!
AW: Need help with a script lag... ASAP! -
Nero_3D - 22.02.2011
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);
}
Re: Need help with a script lag... ASAP! -
[MNC]Azz - 22.02.2011
Mate... just 3 words.... YOU ARE AWSOME!.... Thx a LOT!! i rly needed that!!!!!
Re: Need help with a script lag... ASAP! -
admantis - 22.02.2011
I've edited this post due misread