Posts: 716
Threads: 92
Joined: May 2018
So i have this stock took fron extended actor functions:
pawn Код:
stock IsPlayerInRangeOfActor(playerid, actorid, Float:radius = 5.0)
{
new
Float:x,
Float:y,
Float:z;
if (GetActorPos(actorid, x, y, z))
{
return IsPlayerInRangeOfPoint(playerid, radius, x, y, z) && GetPlayerVirtualWorld(playerid) == GetActorVirtualWorld(actorid);
}
return 0;
}
I have an actor which is id 1, how i can use it this stock to send a message to player? Ex: You're near actor ID 1.
Thanks.
Posts: 34
Threads: 0
Joined: Jul 2018
I hope I will help you by that example code:
PHP код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfActor(playerid, actorid))
SendClientMessage(playerid, -1, "You are near actor");
return 1;
}
stock IsPlayerInRangeOfActor(playerid, actorid, Float:radius = 5.0)
{
new
Float:x,
Float:y,
Float:z;
GetActorPos(actorid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, radius, x, y, z) && GetPlayerVirtualWorld(playerid) == GetActorVirtualWorld(actorid))
return 1;
return 0;
}
I will be grateful if you + my reputation (in case if I helped you..)
Posts: 716
Threads: 92
Joined: May 2018
Thanks, gonna test it now and let you know.
Posts: 716
Threads: 92
Joined: May 2018
Tried, seems to work but i have a problem.
I have currently 2 actors, one at LSPD and one at Los Santos Hospital. Each actor should open a different dialog.
Example: LSPD Actor should open Cops Dialog (already scripted) and LS Hospital actor should open cure menu (did this too).
My question is, how to make it? I was thinking to do with OnPlayerKeyStateChange, by using IsPlayerInRangeOfActor, but i don't know how. (I want the dialog should appear when player is near an actor and presses a key).
In short words:
2 actors should open 2 different dialogs, how i can do this with actorid?
Posts: 716
Threads: 92
Joined: May 2018
I already do. I have a separate fs which handles all actor data. Creating deleting editing and so on. Do you mind helping me?
Posts: 716
Threads: 92
Joined: May 2018
No i just need help with what i asked, please.
Posts: 4,885
Threads: 57
Joined: Jun 2012
Reputation:
0
I just told you what to do... how hard is that ?
Posts: 716
Threads: 92
Joined: May 2018
I dont wanna edit current system since i have already everything done. If you don't wanna help me i'll wait another one. Thanks.