ClientMessage Problem
#1

Hi, after some time trying to fix it by myself...I gave up.
Below is a menu where I can spawn three types of drugs, each one giving a message.
My problem is that on the first pickup, it displays each drug message separately but later on it displays all three messages under 1 pickup.
For example I pickup Drug1 and I get 3 messages, one for each drug. Strange problem.

pawn Код:
if(pickupid == Drug1)
    {
        haveweed[playerid] = 1;
        SendClientMessage(playerid, GREEN, "You picked up Weed, type /useeweed to use!");
        DestroyPickup(Drug1);
    }
    if(pickupid == Drug2)
    {
        haveecstasy[playerid] = 1;
        SendClientMessage(playerid, GREEN, "You picked up Ecstasy, type /useecstasy to use!");
        DestroyPickup(Drug2);
    }
    if(pickupid == Drug3)
    {
        haveheroin[playerid] = 1;
        SendClientMessage(playerid, GREEN, "You picked up Heroin, type /useheroin to use!");
        DestroyPickup(Drug3);
    }
Can anyone help?
Reply
#2

pawn Код:
if(pickupid == Drug1)
    {
        haveweed[playerid] = 1;
        SendClientMessage(playerid, GREEN, "You picked up Weed, type /useeweed to use!");
        DestroyPickup(Drug1);
    }
    else if(pickupid == Drug2)
    {
        haveecstasy[playerid] = 1;
        SendClientMessage(playerid, GREEN, "You picked up Ecstasy, type /useecstasy to use!");
        DestroyPickup(Drug2);
    }
    else if(pickupid == Drug3)
    {
        haveheroin[playerid] = 1;
        SendClientMessage(playerid, GREEN, "You picked up Heroin, type /useheroin to use!");
        DestroyPickup(Drug3);
    }
i think that should solve it
Reply
#3

Yes , that is problem for sure ....
Reply
#4

Pickup IDs are messed up. Here when you destroy Drug1 pickup, Drug2 takes its place (takes the ID of Drug1) thus it's read as Drug1 as well. Store pickups info in an array or give this include a try (https://sampforum.blast.hk/showthread.php?tid=46645).
Reply
#5

@Khalid
I used the include provided above, thanks for that. The pickups seem to be running better.

@BossZk
By adding the "else", I ended up going back to an earlier problem I had when the pickup would only register for one drug (the first one used) meaning if I pickup weed and then ecstasy...it gives me the same effects of weed including the "haveecstasy[playerid] = 1;" array.

I eventually by-passed the problem by removing the text with these pickups.
Thanks all for your help!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)