need help with pickups please -
Guns_N_Roses - 22.02.2009
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?
Re: need help with pickups please -
[RP]Rav - 22.02.2009
first you need to create the pickup ofcourse
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
}
}
Re: need help with pickups please -
JaYmE - 22.02.2009
Only because you like guns and roses :P
At the top of script
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
Re: need help with pickups please -
Guns_N_Roses - 22.02.2009
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))
Re: need help with pickups please -
KnooL - 22.02.2009
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..
Re: need help with pickups please -
Guns_N_Roses - 22.02.2009
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
Re: need help with pickups please -
Coicatak - 23.02.2009
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;
Re: need help with pickups please -
Guns_N_Roses - 23.02.2009
i have them there i still get the same errors
Re: need help with pickups please -
[RP]Rav - 23.02.2009
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
Re: need help with pickups please -
Guns_N_Roses - 23.02.2009
bleh... scripting is a bit confusing to me =\ might have to go with regular tele commands here >.>