Pickup help.
#1

Hello there, I am creating a Kill Confirmed gamemode for myself and a couple of friends and I'm wondering, when I die, I want to have some sort of "Tag" that needs picking up.

BUT, when I come to use pickups, I can't think how I would make then able to be picked up under OnPlayerPickupPickup.


Under OnPlayerDeath(playerid, killerid, reason)

I could have:

CreatePickup(...);

But, with the actual thing, I would need to have it under OnPlayerPickupPickup, so then I can check a team members team to a pickup icon...

Say, if I was on the Marines team and got killed by a spetsnaz, if a Marine was to pick it up, it would just remove the pickup, where as if I was on the Spetsnaz team and I picked it up, it would add +1 to the points?

Thanks!
Reply
#2

pawn Код:
#include <a_samp>
new Pickup[MAX_PLAYERS];
new HasPlayerDied[MAX_PLAYERS];
new Team[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
HasPlayerDied[playerid] = 0;
Team[playerid] = 0;
return 1;
}

public OnPlayerSpawn(playerid)
{
//When they choose a team
Team[playerid] = 1;
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
DestroyPickup(Pickup[playerid]); //To prevent spamming pickups.
Pickup[playerid] = CreatePickup(1240, 8, X, Y, Z, GetPlayerVirtualWorld(playerid)); //Creates pickup where the player died.
HasPlayerDied[playerid] = 1;
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(pickupid == Pickup[i]) {
HasPlayerDied[i] = 0;
if(Pickup[i] != Pickup[playerid]) {
if(Team[playerid] != Team[i]) { //Replace with your own team variables.
new Score = GetPlayerScore(playerid);
SetPlayerScore(playerid, Score + 1);
SendClientMessage(playerid, 0xFF0000AA, "You have recovered an enemy's Death Pickup. 1 score received."); }
else {
new string[256];
new pname[MAX_PLAYER_NAME];
GetPlayerName(i, pname, MAX_PLAYER_NAME);
format(string,sizeof(string),"You have recovered your teammate %s's Death Pickup.",pname[i]);
SendClientMessage(playerid, 0xFF0000AA, string); } }
else return SendClientMessage(playerid, 0xFF0000AA, "You have recovered your own Death Pickup.");
} } }
return 1;
}

public OnPlayerDisconnect(playerid)
{
if(HasPlayerDied[playerid] == 1) {
DestroyPickup(Pickup[playerid]); }
return 1;
}
Reply
#3

This streamer has a function to create dynamic pickups which can be shown to certain players..

Here it is:

pawn Код:
native CreateDynamicPickup(modelid, type, Float:x, Float:y, Float:z, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
In the 8th parameter -1 means it will be shown to ALL players, you can change that to Marine team members (or the team you want it to be shown for) ids (You can do that by looping through all players).
Reply
#4

Or that ^^...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)