mac
02.01.2016, 00:08
В общем, данная херня работает, но криво. Когда захожу в игру - машины спавнятся, но в огромном количестве. Не понимаю, что не так сделал
C++:
#include "script.h"
#include
#include
void
lspd1cars
(
)
{
Vehicle police3Veh1
,
police3Veh2
,
police3Veh3
,
police3Veh4
,
police3Veh5
,
// Машины
policebVeh1
,
policebVeh2
,
policebVeh3
,
policeVeh1
,
policeVeh2
,
policeVeh3
,
police2Veh1
,
police2Veh2
,
polmavVeh1
,
polmavVeh2
,
policetVeh1
,
policetVeh2
;
int
police3Spawned
=
0
,
policebSpawned
=
0
,
policeSpawned
=
0
,
police2Spawned
=
0
,
polmavSpawned
=
0
,
policetSpawned
=
0
;
int
police3SpawnDistance
=
0
,
policebSpawnDistance
=
0
,
policeSpawnDistance
=
0
,
police2SpawnDistance
=
0
,
polmavSpawnDistance
=
0
,
policetSpawnDistance
=
0
;
Ped playerPed
=
PLAYER
::
PLAYER_PED_ID
(
)
;
Vehicle veh
=
PED
::
GET_VEHICLE_PED_IS_USING
(
playerPed
)
;
Vector3 position
=
ENTITY
::
GET_ENTITY_COORDS
(
playerPed
,
1
)
;
DWORD police3
=
GAMEPLAY
::
GET_HASH_KEY
(
"police3"
)
;
police3SpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
408.203
,
-
988.917
,
29.021
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
police3SpawnDistance
100
&&
police3VehDistance
>
100
)
{
if
(
police3Spawned
==
5
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police3Veh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police3Veh2
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police3Veh3
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police3Veh4
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police3Veh5
)
;
police3Spawned
-=
5
;
}
}
DWORD policeb
=
GAMEPLAY
::
GET_HASH_KEY
(
"policeb"
)
;
// Мотоцикл
policebSpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
409.370
,
-
1004.351
,
28.742
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
policebSpawnDistance
100
&&
policebVehDistance
>
100
)
{
if
(
policebSpawned
==
3
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policebVeh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policebVeh2
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policebVeh3
)
;
policebSpawned
-=
3
;
}
}
DWORD police
=
GAMEPLAY
::
GET_HASH_KEY
(
"police"
)
;
// Stainer
policeSpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
431.053
,
-
1026.89
,
28.518
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
policeSpawnDistance
100
&&
policeVehDistance
>
100
)
{
if
(
policeSpawned
==
3
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policeVeh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policeVeh2
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policeVeh3
)
;
policeSpawned
-=
3
;
}
}
DWORD police2
=
GAMEPLAY
::
GET_HASH_KEY
(
"police2"
)
;
// Buffalo
police2SpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
442.408
,
-
1026.017
,
28.319
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
police2SpawnDistance
100
&&
police2VehDistance
>
100
)
{
if
(
police2Spawned
==
2
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police2Veh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police2Veh2
)
;
police2Spawned
-=
2
;
}
}
DWORD polmav
=
GAMEPLAY
::
GET_HASH_KEY
(
"polmav"
)
;
// Вертолет
polmavSpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
482.948
,
-
982.156
,
41.395
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
polmavSpawnDistance
100
&&
polmavVehDistance
>
100
)
{
if
(
polmavSpawned
==
2
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
polmavVeh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
polmavVeh2
)
;
polmavSpawned
-=
2
;
}
}
DWORD policet
=
GAMEPLAY
::
GET_HASH_KEY
(
"policet"
)
;
// Автозак
policetSpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
463.017
,
-
1014.739
,
28.063
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
policetSpawnDistance
100
&&
policеtVehDistance
>
100
)
{
if
(
policetSpawned
==
2
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policetVeh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policetVeh2
)
;
policetSpawned
-=
2
;
}
}
}
void
main
(
)
{
while
(
true
)
{
lspd1cars
(
)
;
WAIT
(
0
)
;
}
}
void
ScriptMain
(
)
{
srand
(
GetTickCount
(
)
)
;
main
(
)
;
}
п.с. Должен быть хотя бы один человек, который работает с этим апи
C++:
#include "script.h"
#include
#include
void
lspd1cars
(
)
{
Vehicle police3Veh1
,
police3Veh2
,
police3Veh3
,
police3Veh4
,
police3Veh5
,
// Машины
policebVeh1
,
policebVeh2
,
policebVeh3
,
policeVeh1
,
policeVeh2
,
policeVeh3
,
police2Veh1
,
police2Veh2
,
polmavVeh1
,
polmavVeh2
,
policetVeh1
,
policetVeh2
;
int
police3Spawned
=
0
,
policebSpawned
=
0
,
policeSpawned
=
0
,
police2Spawned
=
0
,
polmavSpawned
=
0
,
policetSpawned
=
0
;
int
police3SpawnDistance
=
0
,
policebSpawnDistance
=
0
,
policeSpawnDistance
=
0
,
police2SpawnDistance
=
0
,
polmavSpawnDistance
=
0
,
policetSpawnDistance
=
0
;
Ped playerPed
=
PLAYER
::
PLAYER_PED_ID
(
)
;
Vehicle veh
=
PED
::
GET_VEHICLE_PED_IS_USING
(
playerPed
)
;
Vector3 position
=
ENTITY
::
GET_ENTITY_COORDS
(
playerPed
,
1
)
;
DWORD police3
=
GAMEPLAY
::
GET_HASH_KEY
(
"police3"
)
;
police3SpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
408.203
,
-
988.917
,
29.021
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
police3SpawnDistance
100
&&
police3VehDistance
>
100
)
{
if
(
police3Spawned
==
5
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police3Veh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police3Veh2
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police3Veh3
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police3Veh4
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police3Veh5
)
;
police3Spawned
-=
5
;
}
}
DWORD policeb
=
GAMEPLAY
::
GET_HASH_KEY
(
"policeb"
)
;
// Мотоцикл
policebSpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
409.370
,
-
1004.351
,
28.742
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
policebSpawnDistance
100
&&
policebVehDistance
>
100
)
{
if
(
policebSpawned
==
3
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policebVeh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policebVeh2
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policebVeh3
)
;
policebSpawned
-=
3
;
}
}
DWORD police
=
GAMEPLAY
::
GET_HASH_KEY
(
"police"
)
;
// Stainer
policeSpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
431.053
,
-
1026.89
,
28.518
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
policeSpawnDistance
100
&&
policeVehDistance
>
100
)
{
if
(
policeSpawned
==
3
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policeVeh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policeVeh2
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policeVeh3
)
;
policeSpawned
-=
3
;
}
}
DWORD police2
=
GAMEPLAY
::
GET_HASH_KEY
(
"police2"
)
;
// Buffalo
police2SpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
442.408
,
-
1026.017
,
28.319
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
police2SpawnDistance
100
&&
police2VehDistance
>
100
)
{
if
(
police2Spawned
==
2
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police2Veh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
police2Veh2
)
;
police2Spawned
-=
2
;
}
}
DWORD polmav
=
GAMEPLAY
::
GET_HASH_KEY
(
"polmav"
)
;
// Вертолет
polmavSpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
482.948
,
-
982.156
,
41.395
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
polmavSpawnDistance
100
&&
polmavVehDistance
>
100
)
{
if
(
polmavSpawned
==
2
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
polmavVeh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
polmavVeh2
)
;
polmavSpawned
-=
2
;
}
}
DWORD policet
=
GAMEPLAY
::
GET_HASH_KEY
(
"policet"
)
;
// Автозак
policetSpawnDistance
=
GAMEPLAY
::
GET_DISTANCE_BETWEEN_COORDS
(
463.017
,
-
1014.739
,
28.063
,
position
.
x
,
position
.
y
,
position
.
z
,
0
)
;
if
(
policetSpawnDistance
100
&&
policеtVehDistance
>
100
)
{
if
(
policetSpawned
==
2
)
{
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policetVeh1
)
;
ENTITY
::
SET_VEHICLE_AS_NO_LONGER_NEEDED
(
&
policetVeh2
)
;
policetSpawned
-=
2
;
}
}
}
void
main
(
)
{
while
(
true
)
{
lspd1cars
(
)
;
WAIT
(
0
)
;
}
}
void
ScriptMain
(
)
{
srand
(
GetTickCount
(
)
)
;
main
(
)
;
}
п.с. Должен быть хотя бы один человек, который работает с этим апи