SA-MP Forums Archive
After Pickup [HELP] - 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)
+--- Thread: After Pickup [HELP] (/showthread.php?tid=375855)



After Pickup [HELP] - kbalor - 08.09.2012

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;
}



Re: After Pickup [HELP] - JaKe Elite - 08.09.2012

There is pickup type.

Change your pickup type to this value.

22


Re : After Pickup [HELP] - lelemaster - 08.09.2012

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.


Re: Re : After Pickup [HELP] - kbalor - 08.09.2012

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?