30.01.2019, 20:43
PHP код:
#include <a_samp>
#include <streamer>
#include <sscanf2>
#include <ColAndreas>
#include <zcmd>
#include <YSI_Core\y_utils>
#include <YSI_Coding\y_timers>
new Timer:timer1;
new Grass[5];
new br=0;
new scfmString[250];
#define SCM SendClientMessage
#define SCFM(%1,%2,%3) format(scfmString,sizeof(scfmString),%3), SCM(%1,%2,scfmString)
public OnFilterScriptInit()
{
CA_Init();
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
CMD:as(playerid, params[], help)
{
for(new i=0; i<5; i++)
{
new Float:randx = RandomFloat(109.2241-92.6121)+92.6121;
new Float:randy = RandomFloat(-71.6366-(-57.7923))+57.7923;
new Float:z;
CA_FindZ_For2DCoord(randx, randy, z);
Grass[i] = CreatePlayerObject(playerid, 802, randx, randy, z+0.2, 0, 0, 0);
}
timer1 = repeat Tajmer(playerid);
return 1;
}
CMD:aa(playerid, params[], help)
{
stop timer1;
return 1;
}
timer Tajmer[100](playerid)
{
new Float:x,Float:y,Float:z;
for(new i=0; i<sizeof(Grass); i++)
{
GetPlayerObjectPos(playerid, Grass[i], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 1, x, y, z))
{
DestroyPlayerObject(playerid, Grass[i]);
Grass[i] = 0;
br++;
}
}
if(br >= sizeof(Grass))
{
SendClientMessage(playerid, -1,"No grass");
}
return 1;
}
PHP код:
if(IsPlayerInRangeOfPoint(playerid, 1, x, y, z))
{
DestroyPlayerObject(playerid, Grass[i]);
Grass[i] = 0;
br++;
}