Game lag when trying to preload animations
#1

Hello, i am trying to make anim preload to avoid Anim bug not showed for 1st time used, but problem is, script is working, but my game lags for maybe 5 second while 1st spawn. Do you have any ideas how to fix it?

Code:
new AnimLibraies[129][14] =
{
	"AIRPORT","Attractors","BAR","BASEBALL","BD_FIRE","BEACH","benchpress","BF_injection","BIKED","BIKEH",
	"BIKELEAP","BIKES","BIKEV","BIKE_DBZ","BLOWJOBZ","BMX","BOMBER","BOX","BSKTBALL","BUDDY","BUS","CAMERA",
	"CAR","CARRY","CAR_CHAT","CASINO","CHAINSAW","CHOPPA","CLOTHES","COACH","COLT45","COP_AMBIENT","COP_DVBYZ",
	"CRACK","CRIB","DAM_JUMP","DANCING","DEALER","DILDO","DODGE","DOZER","DRIVEBYS","FAT","FIGHT_B","FIGHT_C",
	"FIGHT_D","FIGHT_E","FINALE","FINALE2","FLAME","Flowers","FOOD","Freeweights","GANGS","GHANDS","GHETTO_DB",
	"goggles","GRAFFITI","GRAVEYARD","GRENADE","GYMNASIUM","HAIRCUTS","HEIST9","INT_HOUSE","INT_OFFICE",
	"INT_SHOP","JST_BUISNESS","KART","KISSING","KNIFE","LAPDAN1","LAPDAN2","LAPDAN3","LOWRIDER","MD_CHASE",
	"MD_END","MEDIC","MISC","MTB","MUSCULAR","NEVADA","ON_LOOKERS","OTB","PARACHUTE","PARK","PAULNMAC","ped",
	"PLAYER_DVBYS","PLAYIDLES","POLICE","POOL","POOR","PYTHON","QUAD","QUAD_DBZ","RAPPING","RIFLE","RIOT",
	"ROB_BANK","ROCKET","RUSTLER","RYDER","SCRATCHING","SHAMAL","SHOP","SHOTGUN","SILENCED","SKATE","SMOKING",
	"SNIPER","SPRAYCAN","STRIP","SUNBATHE","SWAT","SWEET","SWIM","SWORD","TANK","TATTOOS","TEC","TRAIN","TRUCK",
	"UZI","VAN","VENDING","VORTEX","WAYFARER","WEAPONS","WUZI"
};
Code:
public OnPlayerSpawn(playerid)
{
    if(!GetPVarType(playerid, "anims_loaded"))
	{
		SetPVarInt(playerid, "anims_loaded", 1);
		for(new a=0; a < 129; a++) ApplyAnimation(playerid,AnimLibraies[a],"null",0.0,0,0,0,0,0);
	}
.
.
.
.
Reply
#2

Use a timer and preload them in batches.
Reply
#3

Use SA-MP Fixes, it will cause you do the animation twice to get around this issue, also means you wont need to "Pre-load" them under "OnPlayerConnect" & you get all the other benefit fixes.

Link: https://github.com/Open-GTO/sa-mp-fixes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)