IsPlayerInRangeOfPoint loop + timer - 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: IsPlayerInRangeOfPoint loop + timer (
/showthread.php?tid=415474)
IsPlayerInRangeOfPoint loop + timer -
reckst4r - 13.02.2013
I'm trying to make a loop and timer, so that the script constantly checks the player location. I need it for this code:
PHP код:
if(IsPlayerInRangeOfPoint(playerid, 1.5, 1742.9924, -1863.2076, 13.5754))
{
ShowPlayerDialog(playerid, 100, DIALOG_STYLE_MSGBOX, "TAXI JOB", "Are you sure you want to take this job?", "Yes", "No");
}
If someone could add a loop & timer for it, it'd be awesome, or just give me an example of how to do it.
Re: IsPlayerInRangeOfPoint loop + timer -
CreativityLacker - 13.02.2013
pawn Код:
forward LOC_CHECK();
public LOC_CHECK()
{
for(new x =0; x < MAX_PLAYERS; x++)
{
if(IsPlayerInRangeOfPoint(x, 1.5, 1742.9924, -1863.2076, 13.5754))
{
ShowPlayerDialog(playerid, 100, DIALOG_STYLE_MSGBOX, "TAXI JOB", "Are you sure you want to take this job", "Yes", "No");
}
}
return 1;
}
public OnGameModeInIt( )
{
SetTimer("LOC_CHECK", 5000, true);
return 1;
}
Though I strongly recommend you avoid this, since it's very inefficient. Try pickups or somethin'
Re: IsPlayerInRangeOfPoint loop + timer -
reckst4r - 13.02.2013
Quote:
Originally Posted by CreativityLacker
pawn Код:
forward LOC_CHECK(); public LOC_CHECK() { for(new x =0; x < MAX_PLAYERS; x++) { if(IsPlayerInRangeOfPoint(x, 1.5, 1742.9924, -1863.2076, 13.5754)) { ShowPlayerDialog(playerid, 100, DIALOG_STYLE_MSGBOX, "TAXI JOB", "Are you sure you want to take this job", "Yes", "No"); } } return 1; }
public OnGameModeInIt( ) { SetTimer("LOC_CHECK", 5000, true); return 1; }
Though I strongly recommend you avoid this, since it's very inefficient. Try pickups or somethin'
|
Hm.. Is the streamer plugin more "efficient" for this?
Re: IsPlayerInRangeOfPoint loop + timer -
CreativityLacker - 13.02.2013
Quote:
Originally Posted by reckst4r
Hm.. Is the streamer plugin more "efficient" for this?
|
I prefer not to use any streamers unless your gamemode is a stunt one with 2000+ objects.
Use default SA-MP pickups?
pawn Код:
new taxi_pickup;
// OnGameModeInIt
{
taxi_pickup = CreatePickup(....);
return 1;
}
// OnPlayerPickupPickUp
if(pickupid == taxi_pickup)
{
ShowPlayerDialog(....);
}
// OnPlayerDialogResponse
if(wautseveras == atwaisds)
{
watever;
}
Re: IsPlayerInRangeOfPoint loop + timer -
reckst4r - 13.02.2013
OK, I'll try that. Thanks alot.
Re: IsPlayerInRangeOfPoint loop + timer -
Babul - 13.02.2013
i suggest you to use a (an invisible) pickup - its radius is close to your 1.5 units required, and it triggers a callback without the need of yet another timer.