Gametext Help!
#1

Hi guys, i want to make so when you enter a pickup you get a gametextforplayer.

Something like this.

Код:
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2441.7549,-1973.6700,13.5469))

{
	Gametextforplayer(blabla);
	return 1;
}
Reply
#2

You can use OnPlayerPickUpPickup callback, by checking if(pickupid == x) and if a player picks that pickup, you can send him a message or give him something.
Reply
#3

On Top
Код:
new XXX;
Under Gamemode interior
Код:
XXX = CreatePickup(model, type, X, Y, Z, Virtualworld);
Public
Код:
public OnPlayerPickupPickup(playerid,pickupid)
{
       if(pickupid == XXX)
       {
	Gametextforplayer(blabla);
       }
       return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerPickUpPickup

Reply
#4

Thank you.
Reply
#5

Quote:
Originally Posted by Chrillzen
Посмотреть сообщение
Thank you.
EDIT: How do i get rid of that?

And it does not display the gametext when i walk into the pickup.


Код:
D:\kyeismyhero\nude\pictures\filterscripts\Weapon.pwn(39) : warning 235: public function lacks forward declaration (symbol "OnPlayerPickupPickup")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
My code


Код:
new Weapon;

public OnFilterScriptInit()
{
    Weapon = CreatePickup(1239, 2, 314.2593,-133.4917,999.6016, 0);
	return 1;
}
  


public OnPlayerPickupPickup(playerid,pickupid)
{
       if(pickupid == Weapon)
       {
	GameTextForPlayer(playerid,"~p~/buygun",2000,5);
       }
       return 1;
}
Reply
#6

add this on top

Код:
forward OnPlayerPickupPickup(playerid,pickupid);
Reply
#7

No warnings but the gametext wont pop up.
Reply
#8

pawn Код:
new
    gPickup;

public OnGameModeInit()
{
    gPickup = CreatePickup(1239, 2, 314.2593,-133.4917,999.6016, 0);
    return 1;
}

public OnPlayerPickupPickup(playerid, pickupid)
{
    if(pickupid == gPickup)
    {
        GameTextForPlayer(playerid,"~p~/buygun",2000,5);
    }
    return 1;
}
If you are using a filterscript, make sure its loading and change "OnGameModeInit" to "OnFilterScriptInit"
Reply
#9

How do i make more than one pickup?

I get this error.

D:\Allt\Spel\SA-MP 0.3C\gamemodes\Gang.pwn(494) : error 010: invalid function or declaration
Reply
#10

You can create an array and hold the pickup ids:
pawn Код:
new
    gPickup[2]; // Number of pickups

public OnGameModeInit()
{
    gPickup[0] = CreatePickup(1239, 2, 314.2593,-133.4917,999.6016, 0); // First pickup
    gPickup[1] = CreatePickup(1239, 2, 314.2593,-133.4917,999.6016, 0); // Second pickup
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == gPickup[0]) // First pickup
    {
        GameTextForPlayer(playerid,"~p~/buygun",2000,5);
    }
    else if(pickupid == gPickup[1]) // Second pickup
    {
        // Do something
    }
    return 1;
}
Reply
#11

No warnings or errors, the gametext does not show tough.
Reply
#12

if you added
pawn Код:
format OnPlayerPickupPickup(playerid, pickupid)
remove it, because its actually
OnPlayerPickUpPickup ( Capitalising mistake )
Reply
#13

Thanks, works great!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)