Teleport bug though Code is right ??
#1

Hey guys,

i made teleport pickups from LSPD garage to LSPD interior 6 ( where the jail is ) . I was searching here and found many topics with the same problem. I fixed all faults in the code and compile, but though it compiled successfully, the teleports aren't working. I don't know what i make wrong, here is my code, i hope you can show me a solution

Код:
new lspdenter;
new lspdexit;
Код:
public OnGameModeInit()
{
    new string[MAX_PLAYER_NAME];
    new string1[MAX_PLAYER_NAME];
	for(new c=0;c<CAR_AMOUNT;c++)
	{
	    lspdexit = CreatePickup(1239, 1, 257.8357,82.7456,1002.4453);
		lspdenter = CreatePickup(1239, 1, 1568.2990,-1691.2732,5.8906);
		Gas[c] = GasMax;
	}                 // the code is here not ending...
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
		if (pickupid == lspdenter)
		{
 			SetPlayerInterior(playerid, 0);
			SetPlayerPos(playerid, 1568.4508,-1697.0718,5.8906);
			SetPlayerFacingAngle(playerid, 175.2836);
			DestroyPickup(lspdenter);
			SendClientMessage(playerid, COLOR_WHITE, "Du bist runter in die PD-Garage gegangen!");
			lspdenter = AddStaticPickup(1239, 1, 1568.2990,-1691.2732,5.8906);
		}
		if (pickupid == lspdexit)
 		{
		 	SetPlayerInterior(playerid, 6);
			SetPlayerPos(playerid, 254.4400,86.5069,1002.4453);
			SetPlayerFacingAngle(playerid, 24.4550);
			DestroyPickup(lspdexit);
			SendClientMessage(playerid, COLOR_WHITE, "Du bist hoch ins Police Department gegangen!");
			lspdexit = AddStaticPickup(1239, 1, 257.8357,82.7456,1002.4453);
		}
		return 1;
}
-Stylerboy-
Reply
#2

Quote:
Originally Posted by Stylerboy
Hey guys,

i made teleport pickups from LSPD garage to LSPD interior 6 ( where the jail is ) . I was searching here and found many topics with the same problem. I fixed all faults in the code and compile, but though it compiled successfully, the teleports aren't working. I don't know what i make wrong, here is my code, i hope you can show me a solution

Код:
new lspdenter;
new lspdexit;
Код:
public OnGameModeInit()
{
    new string[MAX_PLAYER_NAME];
    new string1[MAX_PLAYER_NAME];
	for(new c=0;c<CAR_AMOUNT;c++)
	{
	    lspdexit = CreatePickup(1239, 1, 257.8357,82.7456,1002.4453);
		lspdenter = CreatePickup(1239, 1, 1568.2990,-1691.2732,5.8906);
		Gas[c] = GasMax;
	}                // the code is here not ending...
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
		if (pickupid == lspdenter)
		{
 			SetPlayerInterior(playerid, 0);
			SetPlayerPos(playerid, 1568.4508,-1697.0718,5.8906);
			SetPlayerFacingAngle(playerid, 175.2836);
			DestroyPickup(lspdenter);
			SendClientMessage(playerid, COLOR_WHITE, "Du bist runter in die PD-Garage gegangen!");
			lspdenter = CreatePickup(1239, 1, 1568.2990,-1691.2732,5.8906);
		}
		if (pickupid == lspdexit)
 		{
		 	SetPlayerInterior(playerid, 6);
			SetPlayerPos(playerid, 254.4400,86.5069,1002.4453);
			SetPlayerFacingAngle(playerid, 24.4550);
			DestroyPickup(lspdexit);
			SendClientMessage(playerid, COLOR_WHITE, "Du bist hoch ins Police Department gegangen!");
			lspdexit = CreatePickup(1239, 1, 257.8357,82.7456,1002.4453);
		}
		return 1;
}
-Stylerboy-
SORRY for double posting !! i didnt want it, my fault
Reply
#3

Your set player position coordinates are backwards, you put the exit where the exit icon is
Reply
#4

thx, ok, i'll try to fix it and post later the result ^^
Reply
#5

i changed any names, but i can't fix the code, because i don't know what i have to do, if the coordinates are backwards. The teleporter don't port me anywhere, i still standing in the " i " icon and nothing happens. Maybe my " public OnPlayerPickUpPickup " doesn't work? If i change "CreatePickup" to "AddStaticPickup" the port works, but i will port to sky and fall down.

Код:
new toinsidelspd; // LSPD Police Department
new toinsidegarage; //LSPD Garage
Код:
public OnGameModeInit()
{
	new string[MAX_PLAYER_NAME];
    new string1[MAX_PLAYER_NAME];
	for(new c=0;c<CAR_AMOUNT;c++)
	{
	  toinsidelspd = CreatePickup(1239, 1, 1568.1727,-1691.2698,5.8906);
		toinsidegarage = CreatePickup(1239, 1, 257.7452,82.7204,1002.4453);
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
		if(pickupid == toinsidelspd)
		{
 			SetPlayerInterior(playerid, 6);
			SetPlayerPos(playerid, 255.0044,86.9834,1002.4453);
			SetPlayerFacingAngle(playerid, 4.0366);
			DestroyPickup(toinsidelspd);
			SendClientMessage(playerid, COLOR_WHITE, "Du bist hoch ins Police Department gegangen!");
			toinsidelspd = CreatePickup(1239, 1, 1568.1727,-1691.2698,5.8906);
		}
		if(pickupid == toinsidegarage)
 		{
		 	SetPlayerInterior(playerid, 0);
			SetPlayerPos(playerid, 257.7452,82.7204,1002.4453);
			SetPlayerFacingAngle(playerid, 140.0447);
			DestroyPickup(toinsidegarage);
			SendClientMessage(playerid, COLOR_WHITE, "Du bist runter in die PD Garage gegangen!");
			toinsidegarage = CreatePickup(1239, 1, 257.7452,82.7204,1002.4453);
		}
		return 1;
}
The problem can only be that i set the coordinates backwards, but i need help to fix it

-Stylerboy-
Reply
#6

you can use [pawn][/pawn] tags too and they are better because they color the code right

pawn Код:
new toinsidelspd; // LSPD Police Department
new toinsidegarage; //LSPD Garage
If you put that in a loop, it will be created more as once
pawn Код:
//OnGameModeInit
    toinsidelspd = CreatePickup(1239, 1, 1568.1727,-1691.2698,5.8906);
    toinsidegarage = CreatePickup(1239, 1, 257.7452,82.7204,1002.4453);
Removed the DestroyPickup / CreatePickup lines, they are useless with pickuptype 1
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == toinsidelspd)
    {
        SetPlayerInterior(playerid, 6);
        SetPlayerFacingAngle(playerid, 4.0366);
        SetPlayerPos(playerid, 255.0044, 86.9834, 1002.4453);
        SendClientMessage(playerid, COLOR_WHITE, "Du bist hoch ins Police Department gegangen!");
    }
    if(pickupid == toinsidegarage)
    {
        SetPlayerInterior(playerid, 0);
        SetPlayerFacingAngle(playerid, 140.0447);
        SetPlayerPos(playerid, 1566.1727, -1691.2698, 5.8906); //these cords were wrong
        SendClientMessage(playerid, COLOR_WHITE, "Du bist runter in die PD Garage gegangen!");
    }
    return true;
}
Reply
#7

thank you ! i made it like you tell. Now the teleporter in the LSPD garage ports me to LSPD inside, but the teleport in LSPD inside doesn't port me back to LSPD garage ( i became 2 Messages, one after another:

pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "Du bist hoch ins Police Department gegangen!"); // translation: You were ported to inside of the LSPD
SendClientMessage(playerid, COLOR_WHITE, "Du bist runter in die PD Garage gegangen!"); // translation: You were ported to LSPD garage
it's like i teleported twice, but not to the LSPD garage. The teleporter inside LSPD isn't working. Has somebody any ideas?

i try this for two days and i'm confused now or i'm to silly to understand what you mean
Reply
#8

if oyu're using onplayerpickuppickup i suggest you to stop because as i've been playing it often crashed me on my teleports with pickups. Idk if it's fixed, but nvm. I would suggest you to add a check if player is near the teleport spot and dispay him a message ONCE, like do this (for examle: "Press TAB to teleport" and if player presses tab he gets teleported. i beleave the callback is OnPlayerKeyStateChange.
I would like to help you but i'm not in the mood to script atm. my brain is overloaded by pawno :P
Reply
#9

well, i don't know how to get the teleporter like you said Ignas1337 . I need the teleporter to get criminal to inside of the LSPD, because i want to bring criminal into the LSPD garage with the PD car and they have to go into the teleporter to come into LSPD. If they have to press any button or type a command, it wouldn't fit
Reply
#10

well, you could add a command for police players to get a passanger of their car inside of jail. like /putinjail [playerid] [time]. I suggest you use strtok.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)