Help With Pickups.
#1

Hello im making Gifts OnPlayerDeath..
so its done when player dies it give a gift with pickup. but there is a problem.
when im killing someone and picking the giftpickup it gives me gift. but when i kill a player and i dont pick his giftpickup and i call him and kill him again to make 2 gifts and to pick 2 gifts but when i pick new made pickup it gives me a gift but when i pick old one pickup it dosen't give me gift.

Here is my code.

On Top
PHP код:
#define MAX_GIFTS (500)
new GiftPickupCount;
new 
GiftPickup[MAX_GIFTS];
new 
RandomModel[5][1] = {
    {
19054},
    {
19055},
    {
19056},
    {
19057},
    {
19058}
}; 
Under OnPlayerDeath
PHP код:
new Float:XFloat:YFloat:Z;
GetPlayerPos(playeridX,Y,Z);
new 
Rand random(sizeof(RandomModel));
    
if (
GiftPickupCount MAX_GIFTS)
{
GiftPickupCount ++;
}else{
GiftPickupCount 0;
}
GiftPickup[GiftPickupCount] = CreatePickup(RandomModel[Rand][0], 1XYZGetPlayerVirtualWorld(playerid)) 
Under OnPlayerPickupPickup
PHP код:
for(new 0MAX_GIFTSi++) 
{
    
if(!
IsPlayerConnected(i) || == playerid) continue;
if(
pickupid != GiftPickup[i])continue;
       
GiveGifts(playerid);
SendClientMessage(playerid,-1,""RED"M"GREEN2"E"RED"R"GREEN2"R"RED"Y  "GREEN2"C"RED"H"GREEN2"R"RED"I"GREEN2"S"RED"T"GREEN2"M"RED"A"GREEN2"S!");
format(stringsizeof(string), "Recieved ''%s'' From The Gift Box.",GiftName);
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG,string);
DestroyPickup(GiftPickup[i]);
break;

Reply
#2

pawn Код:
#include <a_samp>
#include <foreach>

#define MAX_GIFTS (500)

new Iterator:GiftPickup<MAX_GIFTS>;

new RandomModel[5][1] = {
    {19054},
    {19055},
    {19056},
    {19057},
    {19058}
};  

public OnPlayerDeath(playerid,killerid,reason)
{
    new Float:X, Float:Y, Float:Z;
    if(Iter_Count(GiftPickup)==MAX_GIFTS)return 1;
    new Rand = random(sizeof(RandomModel));
    GetPlayerPos(playerid, X,Y,Z);
    Iter_Add(GiftPickup,CreatePickup(RandomModel[Rand][0], 1, X, Y, Z, GetPlayerVirtualWorld(playerid)));
    return 1;
}
public OnPlayerPickupPickup(playerid,pickupid)
{
    foreach(new id:GiftPickup)
    {
        if(id == pickupid)
        {
            GiveGifts(playerid);
            SendClientMessage(playerid,-1,""RED"M"GREEN2"E"RED"R"GREEN2"R"RED"Y  "GREEN2"C"RED"H"GREEN2"R"RED"I"GREEN2"S"RED"T"GREEN2"M"RED"A"GREEN2"S!");
            format(string, sizeof(string), "Recieved ''%s'' From The Gift Box.",GiftName);
            SendClientMessage(playerid,COLOR_SERVER_HELP_MSG,string);
            DestroyPickup(id);
            new next;
            Iter_SafeRemove(GiftPickup, id, next);
            id = next;
        }
    }

    return 1;
}
Reply
#3

Got This.
Quote:

F:\Cruel World Deathmatch\Deathmatch Server\pawno\include\sscanf.inc(171) : error 017: undefined symbol "foreach"
F:\Cruel World Deathmatch\Deathmatch Server\pawno\include\sscanf.inc(173) : error 017: undefined symbol "playerid"
F:\Cruel World Deathmatch\Deathmatch Server\pawno\include\sscanf.inc(176) : error 017: undefined symbol "playerid"
F:\Cruel World Deathmatch\Deathmatch Server\gamemodes\DM.pwn(126) : error 001: expected token: "-identifier-", but found "("
F:\Cruel World Deathmatch\Deathmatch Server\gamemodes\DM.pwn(3082) : error 017: undefined symbol "IterCount"
F:\Cruel World Deathmatch\Deathmatch Server\gamemodes\DM.pwn(3085) : error 017: undefined symbol "YSI_gGiftPickupS"
F:\Cruel World Deathmatch\Deathmatch Server\gamemodes\DM.pwn(9716) : error 017: undefined symbol "foreach"
F:\Cruel World Deathmatch\Deathmatch Server\gamemodes\DM.pwn(9716) : error 029: invalid expression, assumed zero
F:\Cruel World Deathmatch\Deathmatch Server\gamemodes\DM.pwn(9716) : warning 215: expression has no effect
F:\Cruel World Deathmatch\Deathmatch Server\gamemodes\DM.pwn(9716) : error 001: expected token: ";", but found ")"
F:\Cruel World Deathmatch\Deathmatch Server\gamemodes\DM.pwn(9716) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


10 Errors.

Reply
#4

pawn Код:
#include <foreach>
and change the IterCount to Iter_Count
Reply
#5

i did i think my include is change or old give me ur foreach include
Reply
#6

fixed.
Reply


Forum Jump:


Users browsing this thread: