need help with pickups please
#1

i want to make a pickup like...

an info icon, when i walk into it, it teleports me somewhere.

how would i go about doing this?
Reply
#2

first you need to create the pickup ofcourse
pawn Код:
AddStaticPickup( .... );
then you need to detect if someone has picked it up
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
   // check where someone is - x, y and z are the pickup coords
   if (PlayerToPoint(playerid, 4, x, y, z))
   {
       SetPlayerPos(playerid, new x, new y, new z);
       SetPlayerFacingAngle(playerid, new angle);
       SetPlayerInterior(playerid, 0); // or any other as required
       SetPlayerVirtualWorld(playerid, 0); // or any other as required
    }
}
Reply
#3

Only because you like guns and roses :P

At the top of script

pawn Код:
new Icon;
in OnGameModeInit()

pawn Код:
Icon = CreateIcon( this stuff here dont know off by heart );
in OnPlayerPickUpPickup()

pawn Код:
if ( pickupid == Icon ) {
  SetPlayerPos( Cords in heres ;) );
}
if you need further help or any problems just reply

Also view: https://sampwiki.blast.hk/wiki/PickupGuide for more infomation
Reply
#4

C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(340) : error 017: undefined symbol "PlayerToPoint"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


340: if (PlayerToPoint(playerid, 4, 1617.8704, -2274.3987, 13.5127))
Reply
#5

Quote:
Originally Posted by [B2F
GunsNRoses ]
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(340) : error 017: undefined symbol "PlayerToPoint"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


340: if (PlayerToPoint(playerid, 4, 1617.8704, -2274.3987, 13.5127))
Why don't u ue the last one, if u make more pickups u have to do that anyway..
Reply
#6



C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(121) : error 017: undefined symbol "LSATC"
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(122) : error 017: undefined symbol "SFATC"
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(123) : error 017: undefined symbol "LVATC"
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(351) : error 017: undefined symbol "LSATC"
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(356) : error 017: undefined symbol "SFATC"
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(361) : error 017: undefined symbol "LVATC"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors


EDIT: just noticed i have SFATC in there twice, that's changed but same errors are still there
Reply
#7

Quote:
Originally Posted by [B2F
GunsNRoses ]


C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(121) : error 017: undefined symbol "LSATC"
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(122) : error 017: undefined symbol "SFATC"
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(123) : error 017: undefined symbol "LVATC"
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(351) : error 017: undefined symbol "LSATC"
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(356) : error 017: undefined symbol "SFATC"
C:\Documents and Settings\********\Desktop\myserver\gamemodes\Born2 Fly.pwn(361) : error 017: undefined symbol "LVATC"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors


EDIT: just noticed i have SFATC in there twice, that's changed but same errors are still there
You need to define your variable, put this at the top of your script (not above includes):
pawn Код:
new LSATC;
new SFATC;
new LVATC;
Reply
#8

i have them there i still get the same errors
Reply
#9

use my code, and add this function to your script

pawn Код:
stock PlayerToPoint(playerid, Float:radi, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);

    tempposx = (oldposx - x);
    tempposy = (oldposy - y);
    tempposz = (oldposz - z);

    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        return 1;

    return 0;
}
as far as I know, pickup IDs are still bugged when you're using a lot of them and therefore aren't reliable, unless you place huge quantities of pickups really close together this works like a charm
Reply
#10

bleh... scripting is a bit confusing to me =\ might have to go with regular tele commands here >.>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)