SA-MP Forums Archive
Cube with Streamer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Cube with Streamer (/showthread.php?tid=609959)



Cube with Streamer - Sanady - 18.06.2016

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;
}*/



Re: Cube with Streamer - Vince - 18.06.2016

If both Z values are the same then you're not creating a cube but a flat plane. Use a dynamic area instead.


Re: Cube with Streamer - Sanady - 18.06.2016

Ahhhh yeaaa, thank you... I wasn`t thinking


Re: Cube with Streamer - Sanady - 19.06.2016

Also, what is the maximum that player can go high, I mean what is biggest Z cord that player can reach?


Re: Cube with Streamer - Vince - 19.06.2016

Top of Mt.Chilliad is 450. Planes can go up to at least 750. Interiors start around 950.