Skip to content

Commit 33cfc87

Browse files
Update README.md
1 parent fb4648b commit 33cfc87

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,103 @@ native bool: pmm_get_point_data( const iPointIndex, const Float: vecOrigin[ 3 ],
102102
*/
103103
native bool: pmm_clear_points( const szObjectName[ ] = "general" );
104104
```
105+
106+
---
107+
108+
### Examples
109+
110+
*Get random point*
111+
```Pawn
112+
new iPointIndex = pmm_get_points( "general", 1 );
113+
if ( iPointIndex == -1 )
114+
return;
115+
116+
new Float: vecOrigin[ 3 ];
117+
pmm_get_point_data( iPointIndex, vecOrigin );
118+
```
119+
120+
*Get random point, with check, point is free*
121+
```Pawn
122+
new iPointIndex = pmm_get_points( "general", 1, true );
123+
if ( iPointIndex == -1 )
124+
return;
125+
126+
new Float: vecOrigin[ 3 ];
127+
pmm_get_point_data( iPointIndex, vecOrigin );
128+
```
129+
130+
*Get random point, with custom callback*
131+
```Pawn
132+
{
133+
// some code
134+
135+
new iPointIndex = pmm_get_points( "general", 1, true, "Point_CallBack" );
136+
if ( iPointIndex == -1 )
137+
return;
138+
139+
new Float: vecOrigin[ 3 ];
140+
pmm_get_point_data( iPointIndex, vecOrigin );
141+
142+
// another code
143+
}
144+
145+
public Point_CallBack( const Float: vecOrigin[ 3 ] )
146+
{
147+
if ( vecOrigin[ 2 ] >= 128.0 )
148+
{
149+
// Point is fit
150+
return true;
151+
}
152+
153+
// The point does not fit - we take the next one
154+
return false;
155+
}
156+
```
157+
158+
*Get N random points from object*
159+
```Pawn
160+
new Array: arPoints = pmm_get_points( "market_place", 5 );
161+
if ( arPoints != Invalid_Array )
162+
{
163+
/**
164+
* In arPoints, we got 5 random points from the "market_place" object
165+
* Next, we already make our own code
166+
*/
167+
168+
// Do not forget to destroy your array with points
169+
ArrayDestroy( arPoints );
170+
}
171+
```
172+
173+
*Get ALL points from ALL objects*
174+
```Pawn
175+
new Array: arPoints = pmm_get_points( "*", PMM_ALL_POINTS );
176+
if ( arPoints != Invalid_Array )
177+
{
178+
/**
179+
* In arPoints we got absolutely all points from all objects
180+
* Next, we already make our own code
181+
*/
182+
183+
// Do not forget to destroy your array with points
184+
ArrayDestroy( arPoints );
185+
}
186+
```
187+
188+
*Get ALL points from object and then clearing the main array of points from the object we need*
189+
```Pawn
190+
new Array: arPoints = pmm_get_points( "presents", PMM_ALL_POINTS );
191+
if ( arPoints != Invalid_Array )
192+
{
193+
/**
194+
* In arPoints we got absolutely all points from the "presents" object
195+
* Next, we already make our own code
196+
*/
197+
198+
// Не забываем уничтожить свой массив с точками
199+
ArrayDestroy( arPoints );
200+
}
201+
202+
// Clearing the main array from the points of the "presents" object
203+
pmm_clear_points( "presents" );
204+
```

0 commit comments

Comments
 (0)