SA-MP Forums Archive
lag - 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)
+--- Thread: lag (/showthread.php?tid=587242)



lag - jamesmith12 - 29.08.2015

this code make's my game lag

PHP код:
public OnPlayerUpdate(playerid)
{
    if(
IsPlayerInArea(playerid,890.625503.906252906.252906.25)) //Same coords as your gangzone
        
{
                
GameTextForPlayer(playerid"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Location Gangzone"30003);
        }
    return 
1;
}
stock IsPlayerInArea(playerid,Float:minX,Float:minY,Float:maxX,Float:maxY)
{
    new 
Float:pX,Float:pY,Float:pZ;
    
GetPlayerPos(playerid,pX,pY,pZ);
    if(
pX >= minX && pX <= maxX && pY >= minY && pY <= maxY) return 1;
    else return 
0;




Re: lag - jamesmith12 - 29.08.2015

bump.


Re: lag - Finn707 - 29.08.2015

Yeah running that stock for every player on your server basically every second probably will create lag (depending on how many players are on your server). I recommend using the area functions in Incognito's Streamer.


Re: lag - jamesmith12 - 29.08.2015

Quote:
Originally Posted by Finn707
Посмотреть сообщение
Yeah running that stock for every player on your server basically every second probably will create lag (depending on how many players are on your server). I recommend using the area functions in Incognito's Streamer.
how ? thanks!


Re: lag - Finn707 - 29.08.2015

First create a dynamic area using one of the several functions:
pawn Код:
new area_1 = CreateDynamicCircle(Float:x, Float:y, Float:size, worldid = -1, interiorid = -1, playerid = -1);
Then you can check if a player is in the area like this:
pawn Код:
IsPlayerInDynamicArea(playerid, area_1);



Re: lag - R0 - 29.08.2015

Just a note, did you try to change the gametext to a client Message?
Try to change:
pawn Код:
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Location Gangzone", 3000, 3);
to:
pawn Код:
SendClientMessage(playerid, -1, "In Area");
test it, if it stays laggy then try as finn told you.( thats just to check because the gametext might be the thing that makes you lag)


Re: lag - jamesmith12 - 29.08.2015

EDIT

Quote:
Originally Posted by R0
Посмотреть сообщение
Just a note, did you try to change the gametext to a client Message?
Try to change:
pawn Код:
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Location Gangzone", 3000, 3);
to:
pawn Код:
SendClientMessage(playerid, -1, "In Area");
test it, if it stays laggy then try as finn told you.( thats just to check because the gametext might be the thing that makes you lag)
ok gonna trry that