repair lag
#1

I have lag. when i use command repair everything works fine but player whos use that command get lagged. like he is not driving smoothly but jumping from spot to spot.. whats the problem? i hope you understand me. Thanks there is the command.

On the start of the script or gamemode...
Код:
forward Repair(playerid)
Under onplayercommandtext
Код:
if (!strcmp("/repair", cmdtext))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You aren't in a vehicle!");
        RepairVehicle(GetPlayerVehicleID(playerid));
	PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        TogglePlayerControllable(playerid,0);
	SetTimerEx("Repair",5000,false,"i",playerid);
        return 1;
    }
Under ongamemodeini - thats for me..
Код:
public Repair(playerid)
{
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid, COLOR_GREEN, "Your vehicle has been repaired!");
    return 1;
}
Reply
#2

Jumping from point to point? He should be freezed while his car is being fixed.
Reply
#3

Quote:
Originally Posted by JiHost
Посмотреть сообщение
Jumping from point to point? He should be freezed while his car is being fixed.
No. You missunderstund. When everything is done. Car repaired and stuff. then.. he plays. drive and then jumps from spot to spot for other players. For him everything is okey
Reply
#4

strange, how long is your script lines?
Reply
#5

@Tanush123: That is in no way relevant.

With the code you show, there is nothing that would signify a sudden lag after the code executes. There may be other parts of the script cause player-specific lag, or maybe it is their connection (or others). Try to diagnose this problem further, if you haven't already, by trying it with different players.
Reply
#6

Quote:
Originally Posted by Bakr
Посмотреть сообщение
@Tanush123: That is in no way relevant.

With the code you show, there is nothing that would signify a sudden lag after the code executes. There may be other parts of the script cause player-specific lag, or maybe it is their connection (or others). Try to diagnose this problem further, if you haven't already, by trying it with different players.
Well usually lags could be caused by mysql sometimes, or a lot of player, or lots of variables and those stuff (i think)
Reply
#7

Lag can be caused by almost (or even) everything in the script. I would just like to assume developers have some type of sense when it comes to coding efficiently (which by this poster's code, he does).
Reply
#8

I know its been a long time when i asked for help in this topic. i left repair thing alone and yesterday i got this problem again. so i checked includes on my gamemode. and found out who making this lag. It was this include http://forum.sa-mp.com/showthread.ph...ight=fixes.inc its making lag on function toggleplayercontrolable.
Cheers. hope it helps for some one who have this too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)