After Pickup [HELP]
#1

Could anyone tell me how to edit this to. If I pick up the cuffin it disappear on my screen, but when someone pick it up it doesn't destroy on their screen but they can pick it up. How do other player destroy the pickup object after they pick it up??



pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
                if(pickupid == tombstonePickups[i])
                {
                new tombstring[MAX_PLAYER_NAME+20];
                GetPlayerName(i,tombstring,MAX_PLAYER_NAME);
                strins(tombstring, "~g~+$400 ~n~~r~Coffin of:~n~~w~", 0);
                GameTextForPlayer(playerid,tombstring,3000,3);
                DestroyPickup(tombstonePickups[playerid]);
                tombstonePickups[playerid] = -1;
                GivePlayerMoney(playerid, 400);
                break;
                }
        }
        return 1;
}
Reply
#2

There is pickup type.

Change your pickup type to this value.

22
Reply
#3

I just want to give a little precision to your codes that could fix you bugs ( It seems you changed the last I gave you xD)


pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
                if(pickupid == tombstonePickups[i]) // Here, you can place back the codes I gave you on the last topic
                {
                new tombstring[MAX_PLAYER_NAME+20];
                GetPlayerName(i,tombstring,MAX_PLAYER_NAME);
                strins(tombstring, "~g~+$400 ~n~~r~Coffin of:~n~~w~", 0);
                GameTextForPlayer(playerid,tombstring,3000,3);
                DestroyPickup(tombstonePickups[i]); //Since you want to remove the coffin of the player that is dead, you'll have to place 'i' and not 'playerid'
                tombstonePickups[i] = -1; // Same for here
                GivePlayerMoney(playerid, 400);
                break;
                }
        }
        return 1;
}
Don't forget to delete the coffin in OnPlayerDisconnect because the id of the player will no longer exist.

Sorry for posting if you didn't want the help I'm giving above.
Reply
#4

Quote:
Originally Posted by lelemaster
Посмотреть сообщение
I just want to give a little precision to your codes that could fix you bugs ( It seems you changed the last I gave you xD)


pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
                if(pickupid == tombstonePickups[i]) // Here, you can place back the codes I gave you on the last topic
                {
                new tombstring[MAX_PLAYER_NAME+20];
                GetPlayerName(i,tombstring,MAX_PLAYER_NAME);
                strins(tombstring, "~g~+$400 ~n~~r~Coffin of:~n~~w~", 0);
                GameTextForPlayer(playerid,tombstring,3000,3);
                DestroyPickup(tombstonePickups[i]); //Since you want to remove the coffin of the player that is dead, you'll have to place 'i' and not 'playerid'
                tombstonePickups[i] = -1; // Same for here
                GivePlayerMoney(playerid, 400);
                break;
                }
        }
        return 1;
}
Don't forget to delete the coffin in OnPlayerDisconnect because the id of the player will no longer exist.

Sorry for posting if you didn't want the help I'm giving above.
No no! @"Sorry for posting if you didn't want the help I'm giving above." I though the first code you've given me was bugged. And realized that it was because of this Coffin doesn't destroyed after someone pick it up (except me). Now its possible to add that code you've posted now to this.

Thanks man!!!!!!!!!!!

(Here is your last code )
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
                if(pickupid == tombstonePickups[i] && i != playerid)
                {
                new tombstring[MAX_PLAYER_NAME+20];
                GetPlayerName(i,tombstring,MAX_PLAYER_NAME);
                strins(tombstring, "~g~+$400 ~n~~r~Coffin of:~n~~w~", 0);
                GameTextForPlayer(playerid,tombstring,3000,3);
                DestroyPickup(tombstonePickups[playerid]);
                tombstonePickups[playerid] = -1;
                GivePlayerMoney(playerid, 400);
                break;
                }
        }
        return 1;
}
And OnplayerDisconnect... is this correct?
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(tombstonePickups[playerid] != -1)
        {
            DestroyPickup(tombstonePickups[i]);
            tombstonePickups[i] = -1;
        }
    }
There is something wrong right?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)