#1

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;

Reply
#2

bump.
Reply
#3

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.
Reply
#4

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!
Reply
#5

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);
Reply
#6

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)
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)