18.06.2016, 10:56
Hello everybody, well, my problem is, when server starts, zone with cube is created, after then, when player spawns, zone appears, after then when player enter cube it should get debug but it`s not showing anything I tried few variants of code but none of them worked, here is the last one which contains last two variants, so take a look and respond in comment:
pawn Код:
//==============================================================================
// OUT OF AREA SYSTEM
//==============================================================================
#include <a_samp>
#include <streamer>
#include <YSI\y_hooks>
//==============================================================================
//--->>> Variables
//==============================================================================
enum ZoneInformation
{
Float:MinX,
Float:MinY,
Float:MinZ,
Float:MaxX,
Float:MaxY,
Float:MaxZ,
GangZona,
GangZoneArea,
};
new zInfo[][ZoneInformation] =
{
//MinX, MinY, MinZ, MaxX, MaxY, MaxZ
{-531.0, -803.5, 300.0, 1660.0, 456.5, 300.0}
};
//==============================================================================
//--->>> Stocks
//==============================================================================
stock CreateOutOfArea()
{
for(new i = 0; i < sizeof(zInfo); i++)
{
zInfo[i][GangZona] = GangZoneCreate(zInfo[i][MinX], zInfo[i][MinY], zInfo[i][MaxX], zInfo[i][MaxY]);
zInfo[i][GangZoneArea] = CreateDynamicCube(zInfo[i][MinX], zInfo[i][MinY], zInfo[i][MinZ], zInfo[i][MaxX], zInfo[i][MaxY], zInfo[i][MaxZ]);
}
return 1;
}
stock DestroyOutOfArea()
{
for(new i = 0; i < sizeof(zInfo); i++)
{
GangZoneDestroy(zInfo[i][GangZona]);
DestroyDynamicArea(zInfo[i][GangZoneArea]);
}
return 1;
}
stock ShowOutOfArea(playerid)
{
for(new i = 0; i < sizeof(zInfo); i++)
{
GangZoneShowForPlayer(playerid, zInfo[i][GangZona], 0x636363AA);
}
return 1;
}
stock HideOutOfArea(playerid)
{
for(new i = 0; i < sizeof(zInfo); i++)
{
GangZoneHideForPlayer(playerid, zInfo[i][GangZona]);
}
return 1;
}
//==============================================================================
//--->>> Hooks
//==============================================================================
hook OnGameModeInit()
{
CreateOutOfArea();
return 1;
}
hook OnGameModeExit()
{
DestroyOutOfArea();
return 1;
}
hook OnPlayerSpawn(playerid)
{
ShowOutOfArea(playerid);
return 1;
}
hook OnPlayerDeath(playerid, killerid, reason[])
{
HideOutOfArea(playerid);
return 1;
}
hook OnPlayerDisconnect(playerid, reason)
{
HideOutOfArea(playerid);
return 1;
}
hook OnPlayerUpdate(playerid)
{
for(new i = 0; i < sizeof(zInfo); i++)
{
if(!IsPlayerInDynamicArea(playerid, zInfo[i][GangZoneArea], 0)) return 0;
if(IsValidDynamicArea(zInfo[i][GangZoneArea]))
{
SendDebug(playerid, "Get back to the battlefield!");
}
}
return 1;
}
//==============================================================================
//--->>> Publics
//==============================================================================
/*public OnPlayerEnterDynamicArea(playerid, areaid)
{
for(new i = 0; i < sizeof(zInfo); i++)
{
if(areaid == zInfo[i][GangZoneArea])
{
SendDebug(playerid, "Get back to the battlefield!");
}
}
return 1;
}
public OnPlayerLeaveDynamicArea(playerid, areaid)
{
return 1;
}*/