28.07.2013, 09:58
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:
I hope you get it like that
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

