just need your opinion here;
#1

Hello,

I want to script that when a player comes to a close range of another player.
the server automaticly gives the player a message that another player is nearby...

There are ALOT of ways to do it i just want your opinion of what would be best and most stable.

i could use a timer repeating itself with isplayerinrangeofpoint and then im done
but i also use incognito's streamer so couldnt i better create a dynamic sphere and attach it to a player ?

Just wanna know what would be best (and if there are better ideas), i dont want to add too many timers than neccesary.

Thanks in advance
Reply
#2

Well, if you're already using the Streamer plugin for streaming objects, why not use it to its fullest? Like you said I would just attach a sphere to a player with a big enough radius and when any other player enters it, notify the player.
Basically the Streamer plugin just gets the maths out of the way and provides ready to use (useful) functions.

(P.S Alot = a lot* , ****** made a nice joke about it.)
Reply
#3

Quote:
Originally Posted by Virtual1ty
Посмотреть сообщение
Well, if you're already using the Streamer plugin for streaming objects, why not use it to its fullest? Like you said I would just attach a sphere to a player with a big enough radius and when any other player enters it, notify the player.
Basically the Streamer plugin just gets the maths out of the way and provides ready to use (useful) functions.

(P.S Alot = a lot* , ****** made a nice joke about it.)
alot XD isee...

well i tried a dynamic sphere but for some reason it doesnt attach properly. I get a message that myself as a player is near the sphere (only on spawn).

pawn Код:
new mysphere[MAX_PLAYERS];
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(GetPVarInt(playerid,"justconnected"))
    {
        mysphere[playerid] = CreateDynamicSphere(0,0,0, 1.0, -1, -1, -1);
        AttachDynamicAreaToPlayer(mysphere[playerid],playerid);
//   justconnected variable makes the player create only on its first spawn
under onplayerenterdynamicarea
pawn Код:
if(areaid == mysphere[playerid])
    {
        SendClientMessage(playerid,COLOR_GRAD2,"your in range of another player..");
    }
on disconnect

DestroyDynamicArea(mysphere[playerid]); //for obvious reasons
Reply
#4

I don't recall the exact parameters for CreateDynamicSphere, but I believe "1.0" is the radius there, try making it bigger, like "8.0" as the former radius just barely surrounds the player AFAIK.
Also when checking if someone enters the "area" exclude the playerid that the area is attached to.
Reply
#5

hmmm...making the sphere bigger like 8.0 doesnt do the trick...its like it doesnt attach to the player at all..
However i am testing this with an npc because i have no players to test this with.
Reply
#6

Are you using the latest version of the plugin? Coz NPC detection for all the area and race callback was added in the R77 update.
Reply
#7

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Are you using the latest version of the plugin? Coz NPC detection for all the area and race callback was added in the R77 update.
Wich is the latest ? arrww ill check that out thanks

Edit: updated andcompiled each script i use in the game but it didnt solve the problem.
Reply
#8

I suggested making the radius bigger cause you want to check the outside edge of the "circle" and trigger an "event" when any player passes that edge. I don't know if dynamic areas take NPCs in consideration... To check if the area is attached and "following" the player try add some messages or visuals like moving object or w.e.
Reply
#9

Quote:
Originally Posted by Virtual1ty
Посмотреть сообщение
I suggested making the radius bigger cause you want to check the outside edge of the "circle" and trigger an "event" when any player passes that edge. I don't know if dynamic areas take NPCs in consideration... To check if the area is attached and "following" the player try add some messages or visuals like moving object or w.e.
Yea i know what you mean, ill try to find out if the attachment is realy there somehow.
and ill get a friend instead of an npc to test it with XD.

I dont believe there is anything bad scripted shown in the third post. maybe someone can remake the same thing for themselves to see if it works for them too ?
Reply
#10

okay i created an object at the position where the area should be.
i disabled the attaching part to test if the dynamic sphere is working at all.
Turns out that i can only see MY dynamic sphere and not the others..wich explains that i wont see the attachment anyway.

i got this onplayerconnect
pawn Код:
mysphere[playerid] = CreateDynamicSphere(0,0,0,8.0,-1,-1-1);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)