[Help] PickupStreamer
#1

Hi, I would like to create my first streamer for pickups. But when I go to pickup ingame ... the pickup does not show.. my amx file has without this inc 150kb and with this include has 450kb and I dont know why..

INC File:

pawn Код:
#define MAX_PICKUPS_EX 800

forward GUPick_Update();
forward GUPick_OnGameModeInit();

enum GUPick_Info{
    P_Model,
    P_Type,
    P_World,
    P_Interior,
    Float:P_X,
    Float:P_Y,
    Float:P_Z,
    Float:P_Vis,
    bool: isCreated

};
enum GUPick_PlayerInfo{
    bool:isPickupStreamed,
    PickupCreatedID

};

new ACT_GUPICK_ID = -1;
new GUPickup[MAX_PICKUPS_EX][GUPick_Info];
new GUPlayerPickup[MAX_PLAYERS_EX][MAX_PICKUPS_EX][GUPick_PlayerInfo];

stock CreateStrPickup(GUP_Model, GUP_Type, Float: GUP_X, Float: GUP_Y, Float: GUP_Z, Float: GUP_Vis = 75.0, GUP_World=-1, GUP_Interior=0)
{
    if(ACT_GUPICK_ID > MAX_PICKUPS_EX)
    {
        printf("Počet pickupov je limitovanэ na %d vбљ počet je %d !, Server sa vypнna", MAX_PICKUPS_EX, ACT_GUPICK_ID);
        SendRconCommand("exit");
    }else{
        ACT_GUPICK_ID++;
        GUPickup[ACT_GUPICK_ID][P_Model] = GUP_Model;
        GUPickup[ACT_GUPICK_ID][P_Type] = GUP_Type;
        GUPickup[ACT_GUPICK_ID][P_X] = GUP_X;
        GUPickup[ACT_GUPICK_ID][P_Y] = GUP_Y;
        GUPickup[ACT_GUPICK_ID][P_Z] = GUP_Z;
        GUPickup[ACT_GUPICK_ID][P_Vis] = GUP_Vis;
        GUPickup[ACT_GUPICK_ID][P_World] = GUP_World;
        GUPickup[ACT_GUPICK_ID][P_Interior] = GUP_Interior;
        GUPickup[ACT_GUPICK_ID][isCreated] = true;
   
    }

    return ACT_GUPICK_ID;
}

stock DestroyStrPickup(pickup)
{
    if(pickup > ACT_GUPICK_ID || pickup < 0)
        return 0;
    GUPickup[ACT_GUPICK_ID][isCreated] = false;
    for(new i=0;i<=MAX_PLAYERS_EX;i++)
    {
        if(GUPlayerPickup[i][pickup][isPickupStreamed] == true)
        {
            GUPlayerPickup[i][pickup][isPickupStreamed] == false;
            DestroyPickup(pickup);
       
        }
   
   
    }


    return 1;
}

public GUPick_OnGameModeInit()
{
    SetTimer("GUPick_Update", 1000, true);

    return 1;
}

public GUPick_Update()
{
    print("Update");
    for(new i=0;i<=MAX_PLAYERS_EX;i++)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
       
            for(new p=0; p<ACT_GUPICK_ID; p++)
            {
       
                if(GUPickup[p][isCreated] == true)
                {
                    if(GetPlayerInterior(i) == GUPickup[p][P_Interior])
                        {
                         if(IsPlayerInRangeOfPoint(i, GUPickup[p][P_Vis], GUPickup[p][P_X], GUPickup[p][P_Y], GUPickup[p][P_Z]))
                         {
                            if(GetPlayerVirtualWorld(i) == GUPickup[p][P_World])
                            {
                                GUPlayerPickup[i][p][PickupCreatedID] = CreatePickup(GUPickup[p][P_Model], GUPickup[p][P_Type], GUPickup[p][P_X], GUPickup[p][P_Y], GUPickup[p][P_Z], GUPickup[p][P_World]);
                                    GUPlayerPickup[i][p][isPickupStreamed] = true;
                              }
                        }else if(!IsPlayerInRangeOfPoint(i, GUPickup[p][P_Vis], GUPickup[p][P_X], GUPickup[p][P_Y], GUPickup[p][P_Z])){
                                DestroyPickup(GUPlayerPickup[i][p][PickupCreatedID]);

                       
                        }
               }

               }

           }
       
        }
   
   
    }
    return 1;
}
Reply
#2

the definitions and vars increase the size!

BTW, this is not looking good so far ;X
Reply
#3

Okay thanks. Donґt you know why pickup is not visible in game ?...
Reply
#4

i haven't had a proper look at the code.
change ur tags from "[code]" to "[pawn]" make it more clear
Reply
#5

Okay, sorry. I changed it
Reply
#6

Pickups are always global, you cant create a pickup for one player only therefore its useless to do
pawn Код:
new GUPlayerPickup[MAX_PLAYERS_EX][MAX_PICKUPS_EX][GUPick_PlayerInfo];
With that knowledge you can remove some pieces of your code

Also you should look in your timer first through all objects and than through the player
Otherwise if as example player is in range of the pickup => pickup gets created
Player two not => pickup gets destroyed again
=> You never see the pickup

The best idea is that you start from the beginning and check out an already existing streamer how they work
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)