House system help
#4

You can. If you use a streamer make sure to place the code in public OnPlayerPickupDynamicPickup, if you use normal pickups without streamer, the code goes under public OnPlayerPickupPickup. To do this, you should make a new variable on top of the script, like, housepickup or something. Then when loading houses, assign the Create(Dynamic)Pickup function to the variable[houseid]. Then under OnPlayerPickup(Dynamic)Pickup you can check the pickupid, and set the correct position.
How I would do it:
pawn Код:
//includes
#define MAX_HOUSES 100 //define how big you want the MAX_HOUSES array
new HousePickup[MAX_HOUSES]; //create the new variable with the size defined above

//some other code

public LoadHouses() //use your loading callback
{
    //your loading code, if you use a loop or something you can assign the function to the variable like this
    HousePickup[i] = Create(Dynamic)Pickup(......);// the [i] is the houseid
    //some moar code probably
}

public OnPlayerPickup(Dynamic)Pickup(pickupid) //this is called when picking up a pickup
{
    for(new i=0; i < MAX_HOUSES; i++) //loop trough all houses
    {
        if(HousePickup[i] == pickupid) //if the variable 'i' in the HousePickup variable matches the pickupid, continue
        {  
        //set the position and world, interior e.t.c. of the player to the corresponding houseid
        }
    }
}

//rest of script
I hope you get it like that
Reply


Messages In This Thread
House system help - by Muhammad1 - 28.07.2013, 09:35
Re: House system help - by JimmyCh - 28.07.2013, 09:41
Re: House system help - by Muhammad1 - 28.07.2013, 09:49
Re: House system help - by Jstylezzz - 28.07.2013, 09:58
Re: House system help - by Sk1lleD - 28.07.2013, 11:45
Re: House system help - by Muhammad1 - 28.07.2013, 12:53
Re: House system help - by wumpyc - 28.07.2013, 13:37
Re: House system help - by Muhammad1 - 28.07.2013, 17:17

Forum Jump:


Users browsing this thread: 1 Guest(s)