SA-MP Forums Archive
help at object teleport - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help at object teleport (/showthread.php?tid=291681)



help at object teleport - Kakioshe22 - 20.10.2011

PHP код:
new pickup1;
new 
pickup2
PHP код:
pickup1 CreatePickup(1318192763.7703,1269.7902,10.7500);
pickup2 CreatePickup(1318191437.1281,-1062.7485,213.3828); 
PHP код:
public OnPlayerPickUpPickup(playeridpickupid)
{
   if(
pickupid == pickup1)
    {
   
SetPlayerPos(playerid1444.4569,-1070.2080,213.3828);
   
SendClientMessage(playerid0xFFFF00FF"You have been teleported to the party!");
   if(
pickupid == pickup2)
   
SetPlayerPos(playerid, -1299.0413,-291.0421,14.1484);
   
SendClientMessage(playerid0xFFFF00FF"Welcome to the San Fiero Airport!");
   return 
1;
    }
   return 
0;

Everything works fine, pickup 1 works good, when i enter pickup 1 i teleport and it says SendClientMessage for both pickups, and when i enter pickup 2 it dissapears nothing happends, pls help


Re: help at object teleport - Haydz - 21.10.2011

You're checking if the player picked up the second pickup when the player is picking up the first pickup but not checking if the second pickup was picked up if the first pickup wasn't picked up.

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
      if(pickupid == pickup1)
     {
             SetPlayerPos(playerid, 1444.4569,-1070.2080,213.3828);
             SendClientMessage(playerid, 0xFFFF00FF, "You have been teleported to the party!");
     } // close the bracket.
     if(pickupid == pickup2)
     {
            SetPlayerPos(playerid, -1299.0413,-291.0421,14.1484);
            SendClientMessage(playerid, 0xFFFF00FF, "Welcome to the San Fiero Airport!");
     }
     return 0;
}