if player is in one of a point
#1

hey, how can i script it, if i want to check , if a player is in one of a point, now i have it so

Код:
new Float:Zapfsaeulenpos[18][3] =
{
    {-2408.0359,976.3800,44.8626}, // Zapfsдule
    {-1674.3197,414.2790,6.7510}, // Zapfsдule
    {-2244.1716,-2560.8372,31.4862}, // Zapfsдule
	{-1606.2764,-2714.0520,48.0732}, // Zapfsдule
	{-90.9248,-1167.9423,1.9717}, // Zapfsдule
	{652.3823,-565.2590,15.8761}, // Zapfsдule
    {1004.1722,-938.2514,41.7149}, // Zapfsдule
    {1943.1042,-1772.6832,12.9306}, // Zapfsдule
    {1380.5253,458.8009,19.5110}, // Zapfsдule
    {2116.0740,920.1754,10.3607},// Zapfsдule
    {2640.3149,1106.2399,10.3607}, // Zapfsдule
    {2202.5315,2472.9653,10.3608}, // Zapfsдule
    {2149.0564,2747.8494,10.3608}, // Zapfsдule
    {1597.6542,2199.5137,10.3605}, // Zapfsдule
    {612.9645,1693.3279,6.5326}, // Zapfsдule
    {-737.0242,2743.7498,46.7639}, // Zapfsдule
    {-1329.1803,2677.7490,49.6022}, // Zapfsдule
    {-1471.3607,1864.0713,32.2093} // Zapfsдule
};

public Checkbezahlttank()
{
    for(new i; i<MAX_PLAYERS;i++)
		{
		    if(tankgeld[i] > 0)
		        {
				    for(new j; j<19;j++)
						{
							if(IsPlayerInRangeOfPoint(i, 20, Zapfsaeulenpos[j][0],Zapfsaeulenpos[j][1],Zapfsaeulenpos[j][2]))
								{
								    IsAtTanke[i] = 1;
								}
							else
							    {
							        IsAtTanke[i] = 0;
							        break;
								}
						}
					if(IsAtTanke[i] == 0)
					    {
					        tankgeld[i] = 0;
							new newsonstige,swant,nnewsonstige[512];
							swant = Playerinfo[i][Want_Sonstige];
							newsonstige = swant + 1;
							Playerinfo[i][Want_Sonstige] = newsonstige;
							Playerinfo[i][Gesucht] = 1;
							format(nnewsonstige,sizeof(nnewsonstige),"%i",newsonstige);
							PlayerTextDrawSetString(i,Textdraw6_Want[i], nnewsonstige);
							PlayerTextDrawShow(i,Textdraw6_Want[i]);
							WriteIntToSQL("samp_user","Gesucht",Playerinfo[i][Gesucht],PName[i]);
							WriteIntToSQL("samp_user","Want_Sonstige",newsonstige,PName[i]);
							SendClientMessage(i, COLOR_ORANGE, "Du wurdes angezeigt! Grund: Nicht bezahlt.");
						}
				}
		}
	return 1;
}
but these doesnt work. because hey check all points, and the player can stay only at one point

please help
Reply
#2

firstly , use [pawn]
secondly , i don't understand any word . please ( improve ) your english
Reply
#3

pawn Код:
new Float:Zapfsaeulenpos[18][3] =
{
    {-2408.0359,976.3800,44.8626}, // Zapfsдule
    {-1674.3197,414.2790,6.7510}, // Zapfsдule
    {-2244.1716,-2560.8372,31.4862}, // Zapfsдule
    {-1606.2764,-2714.0520,48.0732}, // Zapfsдule
    {-90.9248,-1167.9423,1.9717}, // Zapfsдule
    {652.3823,-565.2590,15.8761}, // Zapfsдule
    {1004.1722,-938.2514,41.7149}, // Zapfsдule
    {1943.1042,-1772.6832,12.9306}, // Zapfsдule
    {1380.5253,458.8009,19.5110}, // Zapfsдule
    {2116.0740,920.1754,10.3607},// Zapfsдule
    {2640.3149,1106.2399,10.3607}, // Zapfsдule
    {2202.5315,2472.9653,10.3608}, // Zapfsдule
    {2149.0564,2747.8494,10.3608}, // Zapfsдule
    {1597.6542,2199.5137,10.3605}, // Zapfsдule
    {612.9645,1693.3279,6.5326}, // Zapfsдule
    {-737.0242,2743.7498,46.7639}, // Zapfsдule
    {-1329.1803,2677.7490,49.6022}, // Zapfsдule
    {-1471.3607,1864.0713,32.2093} // Zapfsдule
};
How can i do that if i have several coords. I want to query whether the player is at one of those points.
Reply
#4

pawn Код:
IsAtPoint(playerid)
{
    for(new i = 0; i < 18; i ++) // loop through all positions (0-17)
    {
        // check whether a player is in range (10.0) of this (i.e 0, 1 till 17) index pos
        if(IsPlayerInRangeOfPoint(playerid, 10.0, Zapfsaeulenpos[i][0], Zapfsaeulenpos[i][1], Zapfsaeulenpos[i][2]))
            return 1; // return true
    }
    return 0; // return false
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)