28.02.2018, 10:21
I want to optimize my gamemode and I need some help.I'm put profiler plugin on my server from 01:00 to 11:23 today,so i'm get results.
So there are picture who don't want to download:
https://i.imgur.com/dYcv4Fd.png
So if you can tell me what i need to opimize,because i'm not sure what i need to look on this profiler results.For example i don't understand this:
Is this much?
I use floatcmp just in one line in my mode.For afk check
Short code:
This function I use in OnPlayerUpdate( if(GetSpeed > 299) kick
I'm upload full .html file in attachmens.Thank you
So there are picture who don't want to download:
https://i.imgur.com/dYcv4Fd.png
So if you can tell me what i need to opimize,because i'm not sure what i need to look on this profiler results.For example i don't understand this:
Quote:
operator>=(Float:,Float 1515576 6.83% operator>(Float:,Float 1281151 3.33% |
Quote:
floatcmp 13220491 3.75% |
Short code:
Code:
function AFKCheck(playerid) { GetPlayerPos(playerid, PlayerCurrentPos[playerid][0], PlayerCurrentPos[playerid][1], PlayerCurrentPos[playerid][2]); if(!floatcmp(PlayerCurrentPos[playerid][0], PlayerLastPos[playerid][LastX]) && !floatcmp(PlayerCurrentPos[playerid][1], PlayerLastPos[playerid][LastY])) { PovecajPVarInt(playerid, "PlayerAFK", 1); } else { SetPVarInt(playerid, "PlayerAFK", 0); AFK[playerid] = false; } PlayerLastPos[playerid][LastX] = PlayerCurrentPos[playerid][0]; PlayerLastPos[playerid][LastY] = PlayerCurrentPos[playerid][1]; PlayerLastPos[playerid][LastZ] = PlayerCurrentPos[playerid][2]; if(GetPVarInt(playerid, "PlayerAFK") >= 20) { //kick(afk 20 minute) } return 1; }
Quote:
GetSpeed 790181 8.17% |
Code:
GetSpeed(playerid) { new Float:ST[4]; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]); else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]); ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 178.8617875; return floatround(ST[3]); }