SA-MP Forums Archive
IsPlayerInRangeOfPoint Spam - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: IsPlayerInRangeOfPoint Spam (/showthread.php?tid=248832)



IsPlayerInRangeOfPoint Spam - grand.Theft.Otto - 16.04.2011

When a player is in a certain range of one of my points, the message should show up once, but instead it spams it for the player... here is what I am using:

pawn Код:
// top of script

forward OnPlayerUpdate(playerid);

// OnGameModeInit

SetTimer("OnPlayerUpdate", 300000,false);

// Bottom of script

public OnPlayerUpdate(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 1458.5403,2773.6892,10.8203,270.2072))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Yellow Bell Golf Course! Closest Attractions:  Houses For Sale");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Houses For Sale",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 1476.6757,2248.4155,11.0234,311.4597))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near The Baseball Stadium! Closest Attractions:  None");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~None",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 684.7440,1825.0392,5.2973,347.9508))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near The Bone County Parking Lot! Closest Attractions:  Ammunation");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Ammunation",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, -254.3835,2603.2136,62.8582,271.6301))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Las Payasadas! Closest Attractions:  Abandoned Airfield DM");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Abandoned Airfield DM",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, -308.6426,1538.0610,75.5625,137.4303))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near The Big Ear! Closest Attractions:  Fort Carson Township");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Fort Carson Township",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 258.7179,1410.4845,10.5128,266.1789))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Green Palms! Closest Attractions:  Drylake DM");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Drylake 1 vs. 1 DM",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 780.5908,835.8712,5.8506,102.0777))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Hunter Quarry! Closest Attractions:  Fort Carson Township");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Fort Carson Township",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, -89.4719,1226.3579,19.7422,181.5209))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Fort Carson! Closest Attractions:  Drylake & Area 69 DM");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Drylake & Area 69 DM",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 1924.5118,701.9061,11.1328,178.0881))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Last Dime Motel! Closest Attractions:  Houses For Sale");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Houses For Sale",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 2617.6685,720.1715,14.7396,1.8246))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Rockshore East! Closest Attractions:  None");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~None",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 2836.5410,1290.8303,11.0877,90.1852))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Linden Station! Closest Attractions:  None");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~None",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 2345.9771,1388.4927,42.8203,86.2801))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Royal Casino Lot! Closest Attractions:  None");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~None",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 2472.3328,1876.4146,10.1842,0.3789))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Casino Construction! Closest Attractions:  Bank, Restaurants, LVPD");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Bank, Restaurants, LVPD",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 2290.3767,2429.5330,10.8203,178.4989))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near LV Police Dept.! Closest Attractions:  Bank, Restaurants");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Bank, Restaurants",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 2494.3892,2773.1531,10.8128,91.0779))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near KACC Fuels! Closest Attractions:  Bank, Restaurants, LVPD");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Bank, Restaurants, LVPD",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 1743.3096,2067.3318,10.8203,309.4731))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near LV Fire Dept.! Closest Attractions:  Hospital, Airport");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Hospital, Airport",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 2269.8677,-77.3028,26.5859,178.6199))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Palomino Creek! Closest Attractions:  Read On-Screen Game Text");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~n~~w~Bank, Restaurants, ~n~Houses for sale, Ammunation",8000,3);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, -1514.7152,2525.4023,55.7766,0.3549))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near El Quebrados! Closest Attractions:  Bank, Ammunation, Houses For Sale");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~n~Bank, Ammunation, Houses For Sale",8000,3);
        return 1;
    }
    return 1;
}
I don't know why it is spamming the chat, what have I done wrong?


AW: IsPlayerInRangeOfPoint Spam - antonio112 - 16.04.2011

The OnPlayerUpdate function is already defined and it`s called few times per second. Try forwarding another function.


Re: IsPlayerInRangeOfPoint Spam - grand.Theft.Otto - 16.04.2011

Well I changed all "OnPlayerUpdate" text's to "Welcome", and now it doesn't work


Re: IsPlayerInRangeOfPoint Spam - dud - 16.04.2011

try this

Код:
// top of script

forward Welcome(playerid);

// OnPlayerConnect

SetTimerEx("Welcome", 10000, true, "i", playerid);

// Bottom of script

public Welcome(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 1458.5403,2773.6892,10.8203,270.2072))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Yellow Bell Golf Course! Closest Attractions:  Houses For Sale");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Houses For Sale",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 1476.6757,2248.4155,11.0234,311.4597))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near The Baseball Stadium! Closest Attractions:  None");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~None",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 684.7440,1825.0392,5.2973,347.9508))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near The Bone County Parking Lot! Closest Attractions:  Ammunation");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Ammunation",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, -254.3835,2603.2136,62.8582,271.6301))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Las Payasadas! Closest Attractions:  Abandoned Airfield DM");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Abandoned Airfield DM",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, -308.6426,1538.0610,75.5625,137.4303))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near The Big Ear! Closest Attractions:  Fort Carson Township");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Fort Carson Township",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 258.7179,1410.4845,10.5128,266.1789))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Green Palms! Closest Attractions:  Drylake DM");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Drylake 1 vs. 1 DM",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 780.5908,835.8712,5.8506,102.0777))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Hunter Quarry! Closest Attractions:  Fort Carson Township");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Fort Carson Township",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, -89.4719,1226.3579,19.7422,181.5209))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Fort Carson! Closest Attractions:  Drylake & Area 69 DM");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Drylake & Area 69 DM",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 1924.5118,701.9061,11.1328,178.0881))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Last Dime Motel! Closest Attractions:  Houses For Sale");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Houses For Sale",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 2617.6685,720.1715,14.7396,1.8246))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Rockshore East! Closest Attractions:  None");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~None",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid, 20.0, 2836.5410,1290.8303,11.0877,90.1852))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Linden Station! Closest Attractions:  None");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~None",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 2345.9771,1388.4927,42.8203,86.2801))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Royal Casino Lot! Closest Attractions:  None");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~None",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 2472.3328,1876.4146,10.1842,0.3789))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Casino Construction! Closest Attractions:  Bank, Restaurants, LVPD");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Bank, Restaurants, LVPD",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 2290.3767,2429.5330,10.8203,178.4989))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near LV Police Dept.! Closest Attractions:  Bank, Restaurants");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Bank, Restaurants",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 2494.3892,2773.1531,10.8128,91.0779))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near KACC Fuels! Closest Attractions:  Bank, Restaurants, LVPD");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Bank, Restaurants, LVPD",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 1743.3096,2067.3318,10.8203,309.4731))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near LV Fire Dept.! Closest Attractions:  Hospital, Airport");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~w~Hospital, Airport",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, 2269.8677,-77.3028,26.5859,178.6199))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near Palomino Creek! Closest Attractions:  Read On-Screen Game Text");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~n~~w~Bank, Restaurants, ~n~Houses for sale, Ammunation",8000,3);
    }
    if(IsPlayerInRangeOfPoint(playerid,20.0, -1514.7152,2525.4023,55.7766,0.3549))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Hey! I See You Are Near El Quebrados! Closest Attractions:  Bank, Ammunation, Houses For Sale");
        GameTextForPlayer(playerid,"~r~Closest Attraction: ~n~ ~n~Bank, Ammunation, Houses For Sale",8000,3);
    }
    return 1;
}



Re: IsPlayerInRangeOfPoint Spam - grand.Theft.Otto - 16.04.2011

Still doesn't work...


Re: IsPlayerInRangeOfPoint Spam - CrazyBlob - 16.04.2011

to be honest i would use a timer called every 1second ish because onplayerupdate is called when a player moves the camera or does anything and it might lag alot


Re: IsPlayerInRangeOfPoint Spam - flameartist - 10.08.2011

Well The Guys Are Writing The Working Code All you have to do is
Top of the Script

pawn Код:
#include <a_samp>



Re: IsPlayerInRangeOfPoint Spam - PrawkC - 10.08.2011

This guys scripting for money, this thread makes me laugh.. thanks for making my day.


Re: IsPlayerInRangeOfPoint Spam - grand.Theft.Otto - 10.08.2011

No problem. I had this fixed for a really long time now.

Thanks for making my day by bumping a 4 month old topic.

You make me laugh.


Re: IsPlayerInRangeOfPoint Spam - PrawkC - 10.08.2011

Well, really I didn't bump the 4 month old topic.. this topic is active today.

My day is still made, lets end it here.