• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] too resource-intensive array
#6
You want to a local IC chat about RP servers etc?



Just use something like this maybe, no need for that..-

Code:
public OnPlayerText(playerid, text[])

{

    new Float:Pos[3];

    GetPlayerPosition(playerid, Pos[0], Pos[1], Post[2]);

    new str[ 128  1 ];

    format(str, sizeof str, "whatever you want here..");

    for(new i = 0; i != MAX_PLAYERS; i)

    {

        if(!IsPlayerConnected(i)) continue;

        if(!IsPlayerInRangeOfPoint(i, 30.0, Pos[0], Pos[1], Post[2])) continue;

        if(GetPlayerVirtualWorld(i) != GetPlayerVirtualWorld(playerid) || GetPlayerInterior(i) != GetPlayerInterior(playerid)) continue;

        new Float:dis;

        dis = GetDistanceBetweenPlayers(playerid,i);

        if(dis <=25 ) SendClientMessage(i, -1, str); // change the distance here

    }

    return 0;

}



stock GetDistanceBetweenPlayers(playerid, playerid2)

{

    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;

    new Float:tmpdis;

    GetPlayerPos(playerid,x1,y1,z1);

    GetPlayerPos(playerid2,x2,y2,z2);

    tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)繚᪶騰(floatabs(floatsub(y2,y1)),2)繚᪶騰(floatabs(floatsub(z2,z1)),2));

    return floatround(tmpdis);

}
  Reply


Messages In This Thread
too resource-intensive array - by Mark2 - 2019-04-19, 08:42 PM
RE: too resource-intensive array - by Mark2 - 2019-04-20, 07:19 AM
RE: too resource-intensive array - by Markski - 2019-04-20, 12:53 PM
RE: too resource-intensive array - by Y_Less - 2019-04-20, 11:05 AM
RE: too resource-intensive array - by unix - 2019-04-25, 09:47 PM

Forum Jump: