SA-MP Forums Archive
Range of point help - 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: Range of point help (/showthread.php?tid=574309)



Range of point help - dundolina - 15.05.2015

Hello i have random checkpoints and how to add them in range of point?

Код:
 new Float:RandomMoneyBoxVzimane[][3] =
{
	{2227.74, 1516.43, 10.82},
	{-724.44, 1402.81, 13.07},
	{-1940.61, 1086.14, 53.09},
	{-2344.37, -459.59, 80.01},
	{-1674.65, -543.03, 14.14},
	{-2415.30, -2142.08, 52.37},
	{-1527.47, -2291.62, -5.63},
	{-1111.05, -2470.04, 76.59},
	{-288.23, -2163.67, 28.63},
	{-376.27, -2583.97, 138.17},
	{378.32, -1885.70, 2.05},
	{1120.86, -2065.82, 74.42},
	{1583.25, -2286.55, 13.53},
	{2718.67, -2385.16, 13.63},
	{2744.79, -1944.55, 17.32},
	{2041.71, -1715.58, 13.54},
	{2771.79, -1354.51, 50.00},
	{1102.96, -1092.89, 28.46},
	{727.73, -1276.13, 13.64},
	{755.31, -591.31, 18.01},
	{360.91, -110.02, 1.22},
	{-557.35, -541.28, 25.52},
	{-273.04, -955.98, 38.30},
	{1242.36, 327.17, 19.75},
	{2791.64, 2225.64, 14.66},
	{-1955.01, -986.97, 35.89},
	{-2108.89, -2376.97, 30.62},
	{1853.35, 2045.54, 10.85},
	{2478.85, -1437.22, 25.49},
	{-2241.50, 2462.93, 4.98},
	{703.36, 267.78, 21.44},
	{-599.09, -1080.95, 23.66},
	{-2677.68, 1503.98, 2.07},
	{2582.18, -2115.22, 1.11},
	{-1954.97, -986.27, 35.89},
	{541.41, 830.33, -39.44},
	{-2876.66, 292.77, 6.96},
	{-2192.16, 2409.51, 4.95},
	{2615.91, -1730.39, 6.24},
	{-529.81, -991.29, 24.55},
	{-1048.33, -1306.72, 128.50},
	{1227.20, 2584.68, 10.82},
	{1016.48, 1411.63, 10.82},
	{-1593.62, 802.54, 6.82},
	{-2238.23, -2478.96, 31.19},
	{917.43, 2402.92, 10.82},
	{1312.97, -1965.60, 29.46},
	{-120.59, -1531.31, 3.07},
	{-2508.68, -53.19, 25.65},
	{-2762.04, 105.18, 6.99},
	{1367.53, 194.54, 19.55},
	{-2655.83, -102.70, 3.99},
	{2161.85, -102.76, 2.75},
	{2535.77, 1342.55, 10.82},
	{-2059.10, 890.89, 61.85},
	{1188.14, 231.38, 19.56},
	{1088.81, 1073.79, 10.83},
	{422.96, 2539.45, 16.52},
	{-227.49, 2709.91, 62.98},
	{-347.38, 1581.21, 76.30},
	{-208.08, 1127.93, 19.74},
	{33.24, 1155.21, 19.69},
	{1582.07, -2691.56, 6.12},
	{1715.25, -1912.01, 13.56},
	{286.36, -1145.15, 80.91}
};
Код:
    if (IsPlayerInRangeOfPoint(playerid, 3.0,MB1))
     {
		  PlayerInfo[playerid][pKufar] = 1;
		  Kufar = 1;
		  Moneybox = 0;
                        							format(string2, sizeof(string2), "Moneybox: %s взе куфара!",PlayerName(playerid));
							SendClientMessageToAll(COLOR_GREEN, string2);
          SendClientMessage(playerid,COLOR_GREEN,"Ти взе куфара сега трябва да го доставиш!");
                                     DisablePlayerCheckpoint(i);
                            DisablePlayerCheckpoint(playerid);
          SetPlayerCheckpoint(i, MB2, 3.0);
          SetPlayerCheckpoint(playerid, MB2, 3.0);

     }



Re: Range of point help - JaydenJason - 15.05.2015

1st off your indenting, what the hell

IsPlayerInRangeOfPoint(playerid, 3.0,MB1)
mb1? what is that even supposed to mean
mb2? ...
unless you have it defined put it in here

and in which callback is that placed?

edit: might want to look at this

https://sampwiki.blast.hk/wiki/SetPlayerRaceCheckpoint


Re: Range of point help - Abagail - 15.05.2015

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
IsPlayerInRangeOfPoint(playerid, 3.0,MB1)
mb1? what is that even supposed to mean
mb2? ...
edit: might want to look at this
#define mb2 0, 0, 0
Nothing wrong with it, as the define will simply replace the text assuming this is how he defines mb2.


Re: Range of point help - Luis- - 15.05.2015

Would be nice to see the mb1 define if you do have one.


Re: Range of point help - dundolina - 15.05.2015

I want to replace this MB1 with this all checkpoints. MB1 is just one of them.


Re: Range of point help - dundolina - 16.05.2015

Help?


Re: Range of point help - Smileys - 16.05.2015

I'll help ya when I get on my pc.


Re: Range of point help - Logofero - 16.05.2015

PHP код:
new Float:RandomMoneyBoxVzimane[][3] =
{
    {
2227.741516.4310.82},
    {-
724.441402.8113.07},
    {-
1940.611086.1453.09},
    {-
2344.37, -459.5980.01},
    {-
1674.65, -543.0314.14},
    {-
2415.30, -2142.0852.37},
    {-
1527.47, -2291.62, -5.63},
    {-
1111.05, -2470.0476.59},
    {-
288.23, -2163.6728.63},
    {-
376.27, -2583.97138.17},
    {
378.32, -1885.702.05},
    {
1120.86, -2065.8274.42},
    {
1583.25, -2286.5513.53},
    {
2718.67, -2385.1613.63},
    {
2744.79, -1944.5517.32},
    {
2041.71, -1715.5813.54},
    {
2771.79, -1354.5150.00},
    {
1102.96, -1092.8928.46},
    {
727.73, -1276.1313.64},
    {
755.31, -591.3118.01},
    {
360.91, -110.021.22},
    {-
557.35, -541.2825.52},
    {-
273.04, -955.9838.30},
    {
1242.36327.1719.75},
    {
2791.642225.6414.66},
    {-
1955.01, -986.9735.89},
    {-
2108.89, -2376.9730.62},
    {
1853.352045.5410.85},
    {
2478.85, -1437.2225.49},
    {-
2241.502462.934.98},
    {
703.36267.7821.44},
    {-
599.09, -1080.9523.66},
    {-
2677.681503.982.07},
    {
2582.18, -2115.221.11},
    {-
1954.97, -986.2735.89},
    {
541.41830.33, -39.44},
    {-
2876.66292.776.96},
    {-
2192.162409.514.95},
    {
2615.91, -1730.396.24},
    {-
529.81, -991.2924.55},
    {-
1048.33, -1306.72128.50},
    {
1227.202584.6810.82},
    {
1016.481411.6310.82},
    {-
1593.62802.546.82},
    {-
2238.23, -2478.9631.19},
    {
917.432402.9210.82},
    {
1312.97, -1965.6029.46},
    {-
120.59, -1531.313.07},
    {-
2508.68, -53.1925.65},
    {-
2762.04105.186.99},
    {
1367.53194.5419.55},
    {-
2655.83, -102.703.99},
    {
2161.85, -102.762.75},
    {
2535.771342.5510.82},
    {-
2059.10890.8961.85},
    {
1188.14231.3819.56},
    {
1088.811073.7910.83},
    {
422.962539.4516.52},
    {-
227.492709.9162.98},
    {-
347.381581.2176.30},
    {-
208.081127.9319.74},
    {
33.241155.2119.69},
    {
1582.07, -2691.566.12},
    {
1715.25, -1912.0113.56},
    {
286.36, -1145.1580.91}
};
#define MAX_RANGE_PICKUP (2.0)
new money_box[][MAX_PLAYERS];
public 
OnPlayerSpawn(playerid) {
    for(new 
isizeof(RandomMoneyBoxVzimane); ji++) {
        
money_box[i][playerid]=1// Enable ALL money box for respaw player
    
}
    return 
1;
}
public 
OnPlayerUpdate(playerid) {
    for(new 
isizeof(RandomMoneyBoxVzimane); ji++) {
        if (
money_box[i][playerid] && IsPlayerInRangeOfPoint(playeridMAX_RANGE_PICKUPRandomMoneyBoxVzimane[i][0], RandomMoneyBoxVzimane[i][1], RandomMoneyBoxVzimane[i][2]))
        {
            
money_box[i][playerid]=0// Disable money box if pickuped
        
            
PlayerInfo[playerid][pKufar] = 1;
            
Kufar 1;
            
Moneybox 0;
            
format(string2sizeof(string2), "Moneybox: %s взе куфара!",PlayerName(playerid));
            
SendClientMessageToAll(COLOR_GREENstring2);
            
SendClientMessage(playerid,COLOR_GREEN,"Ти взе куфара сега трябва да го доставиш!");
            break;
        } 
     }
     




Re: Range of point help - KeNTos - 16.05.2015

For(new I; i< sizeof(RandomMoneyBoxVzimane); i++)
(
if (IsPlayerInRangeOfPoint(playerid, 3.0, RandomMoneyBoxVzimane[0], RandomMoneyBoxVzimane[1], RandomMoneyBoxVzimane[2]))
{
PlayerInfo[playerid][pKufar] = 1;
Kufar = 1;
Moneybox = 0;
format(string2, sizeof(string2), "Moneybox: %s âçå êóôàðà!",PlayerName(playerid));
SendClientMessageToAll(COLOR_GREEN, string2);
SendClientMessage(playerid,COLOR_GREEN,"Òè âçå êóôàðà ñåãà òðÿáâà äà ãî äîñòàâèø!");
DisablePlayerCheckpoint(i);
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(i, MB2, 3.0);
SetPlayerCheckpoint(playerid, MB2, 3.0);

}
)
Еще можешь сделать break в вконце цикла, я просто до конца не понял что тебе нужно)


Re: Range of point help - Logofero - 16.05.2015

Quote:
Originally Posted by KeNTos
Посмотреть сообщение
For(new I; i< sizeof(RandomMoneyBoxVzimane); i++)
Better one time to declare a variable than to constantly seek to call the same function
Example:
PHP код:
for(new isizeof(RandomMoneyBoxVzimane); i<ji++) {
...