SA-MP Forums Archive
Pickup only for a specific team - 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: Pickup only for a specific team (/showthread.php?tid=200044)



Pickup only for a specific team - Face9000 - 17.12.2010

Hi,i need little help.

In my gm i've definied team with gTeam.

I need to make a pickup working only for a team (In this case,Swat).

How to?


Re: Pickup only for a specific team - Face9000 - 18.12.2010

BUMPPP


Re: Pickup only for a specific team - iggy1 - 18.12.2010

Do you use a pickup stremer? if you use incognitos plugin you can easily show pickups for certain players only with the playerid parameter.


Re: Pickup only for a specific team - Berky - 18.12.2010

Explain more please... Pickup like what?


Re: Pickup only for a specific team - iggy1 - 18.12.2010

Quote:
Originally Posted by Berky
Посмотреть сообщение
Explain more please... Pickup like what?
What do you think he means by pickup? I'm guessing pickups!


Re: Pickup only for a specific team - [UG]Scripter - 18.12.2010

UNTESTED and Off the top of my head...

pawn Код:
public OnPlayerPickupPickUp()
{
// START
// Pickup Code
if(pickup == pickup)
{
if(gTeam[playerid] == Team)
{
// Code Here
}
return 1;
}

// END
return 1;
}



Re: Pickup only for a specific team - Berky - 18.12.2010

What do you wanna make, pickups ONLY displaying for a certain faction, OR pickups ONLY WORKING for a certain faction?


Re: Pickup only for a specific team - [UG]Scripter - 18.12.2010

Quote:
Originally Posted by Berky
Посмотреть сообщение
What do you wanna make, pickups ONLY displaying for a certain faction, OR pickups ONLY WORKING for a certain faction?
Read the origional post he said working for a speciifc team only.


Re: Pickup only for a specific team - Rachael - 18.12.2010

firstly, choose a pickup type that will suit your needs ( 23 is a good choice )
https://sampwiki.blast.hk/wiki/PickupTypes
pawn Код:
new your_pickup = CreatePickup( <insert your parameters here > );

public OnPlayerPickupPickup(playerid, pickupid)
{
     if(gTeam[playerid] == 2) //or whatever team you want to be able to access the pickup
     {
          // put your code here, for whatever you want to do
     }
     return 1;
}
I have not used non-streamed pickups for quite a while, but this should work, if you put some effort into adding the code that you need to do what you want to do here.


Re: Pickup only for a specific team - iggy1 - 18.12.2010

I'll give you a nice way to do it incase you do use the streamer plugin. I've used these callbacks as an example i dont know where you need this. Unless im mistaken these pickups wont even show on other players screens.
pawn Код:
#include <a_samp>
#include <streamer>

#define MAX_T_PICKUPS           (50)//changme

#define SWAT                    (1)

new gTeam[MAX_PLAYERS];

new TeamPickups[MAX_PLAYERS][MAX_T_PICKUPS];

public OnPlayerConnect(playerid)
{
    gTeam[playerid] = SWAT;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    gTeam[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == SWAT)
    {
        TeamPickups[playerid][0] = CreateDynamicPickup(28, 23, 0.0, 0.0, 0.0, -1, -1, playerid, 100.0);//swap co-ords obviously
        TeamPickups[playerid][1] = CreateDynamicPickup(29, 23, 0.0, 0.0, 0.0, -1, -1, playerid, 100.0);
    }
    return 1;
}
Without the streamer only think that comes to my mind that might work is this, (and what the nice people above said)
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == swatpickup && gTeam[playerid] != SWAT) return 0;
    return 1;
}