SA-MP Forums Archive
help with pickups[SOLVED] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help with pickups[SOLVED] (/showthread.php?tid=123253)



help with pickups[SOLVED] - Lorenc_ - 25.01.2010

Well I was following the sa-mp wiki to do some research about pickups.

I've made the info pickup but when i run through it the game text doesn't pop up..

This is what the pickup and stuff are..


pawn Код:
dive = AddStaticPickup(1239, 2, 1763.684,-1486.484,453.757);
and the 'OnPlayerPickUpPickup' function.
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(pickupid == dive) GameTextForPlayer(playerid,"Jump out and dive!!",2500,6);
}
Please help!
Thanks,
Lorenc


Re: help with pickups - Lorenc_ - 25.01.2010

any1 I still dont get it plz help


Re: help with pickups - pierhs - 25.01.2010

Use the PlayerToPoint function and then make a timer that checks the players position.If he is in the spot he will show that text


Re: help with pickups - Lorenc_ - 25.01.2010

Quote:
Originally Posted by Chuck_Taylor
Use the PlayerToPoint function and then make a timer that checks the players position.If he is in the spot he will show that text
pawn Код:
if(PlayerToPoint(2.0,playerid,1763.684, -1486.484, 453.757))
{
GameTextForPlayer(playerid,"Jump out and dive!!",2500,6);
return 1;
}
So where do i place the playetopoint func?
It dosent work under gamemodeinit....


Re: help with pickups - CuervO - 25.01.2010

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(pickupid == dive) return GameTextForPlayer(playerid,"Jump out and dive!!",2500,6);
}

or


pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(pickupid == dive) { GameTextForPlayer(playerid,"Jump out and dive!!",2500,6); }
}



Re: help with pickups - Lorenc_ - 26.01.2010

Quote:
Originally Posted by CueЯvo
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(pickupid == dive) return GameTextForPlayer(playerid,"Jump out and dive!!",2500,6);
}

or


pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(pickupid == dive) { GameTextForPlayer(playerid,"Jump out and dive!!",2500,6); }
}
don't work


Re: help with pickups - Calgon - 26.01.2010

Add this in OnGameModeInit:

pawn Код:
SetTimer( "PickupMessages", 1500, true );
Add this below OnGameModeInit:
pawn Код:
forward PickupMessages();
public PickupMessages()
{
    new Float: TX, Float: TY, Float: TZ;
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        GetPlayerPos( i, TX, TY, TZ );
       
        if( IsPlayerInRangeOfPoint( i, 5.0, 1763.684, -1486.484, 453.757 ) )
        {
          GameTextForPlayer( i, "Jump out and dive!", 2500, 6 );
        }
    }
    return 1;
}



Re: help with pickups - PRANK - 26.01.2010

Use CreatePickup.. I think.


Re: help with pickups - Lorenc_ - 26.01.2010

Quote:
Originally Posted by PRANK
Use CreatePickup.. I think.
I've already created a pick up but if i go thro it the game text dosen't work..
Does anyone know how i could make it if i pick the pickup the gametext appears
clearly the public OnPlayerPickUpPickup(playerid, pickupid) func dont work...


Re: help with pickups - kmzr - 26.01.2010

pawn Код:
if(PlayerToPoint(3.0,playerid,x,y,z)) return SendClientMessage(playerid, COLOR_GREEN, "Jump out and dive!");
Put the coords of your pickup where it says x,y,z

pawn Код:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  if(IsPlayerConnected(playerid))
    {
        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);
        //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
pawn Код:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);