Pickup Teleports - Return To Location
#1

Okay well, I have scripted up a pickup which teleports me to an interior and there is one problem.

So I am in the interior and when I exit, I get teleported to the ORIGINAL location.

This is my script:
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

new ammu1;

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" My Teleports");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" SWIFT DRIFT");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	ammu1 = CreatePickup(1318,23,-2398.0510,-575.4337,132.3125);

	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid == ammu1)
{
GameTextForPlayer(playerid,"~r~Ammunation", 6000,1);
SetPlayerPos(playerid, 286.800994,-82.547599,1001.515625);
SetPlayerInterior(playerid, 4);
}
return 1;
}
In this script I set up a teleport to Ammunation, and when I exit Ammunation I get sent to a different location then where I inserted the pickup.

If anyone could help, that'd be great!

Regards,
Swift.
Reply
#2

Anyone?
Reply
#3

You could use OnPlayerInteriorChange and teleport him to the location you want... If that want you want..
Reply
#4

An example mate?
Reply
#5

Quote:
Originally Posted by Swiftyy
Посмотреть сообщение
An example mate?
pawn Код:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    if(oldinteriorid == old interoior id) //Change old interior id
    {
        SetPlayerPos(playerid, X, Y, Z); // New position
    }
    return 1;
}
Replace the coords and the interior id..
Reply
#6

Okay will test this out. Thanks mate.
Reply
#7

That's not a very efficient way of doing it, because then each time you change interior, you have the chance of being teleported to the same location, even when you don't want to do so. First of all, add the following under OnGameModeInit()...

pawn Код:
public OnGameModeInit()
{
    DisableInteriorEnterExits();
    return 1;
}
Then, you may need to add another pickup for the EXIT of ammunition. A better way would be to use a checkpoint system of some sort. I would recommend Incognito's Streamer plugin for such a method. Just make sure, when you enter the ammunation, that you are teleporting them away from the exit, so that when you enter, you're not spawning on top of the exit pickup. Same applies for when you exit and in vice versa.
Reply
#8

thanks mate, I understand it. It should work, will test it now.

Also will this disable ALL other default interiors? e.g - 24/7s, bars, cluckin' bells, etc. ?
Reply
#9

It will be more easy if you make one more pickup in ammunition.. front of the exit door to exit. And set pos to out side.hope you understand.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)