SA-MP Forums Archive
How to create /drop for items? - 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: How to create /drop for items? (/showthread.php?tid=435752)



How to create /drop for items? - lQs - 08.05.2013

Hey, i have something like that:

pawn Код:
//=================//
command(dropgun, playerid, params[])
{
    new Float:X,Float:Y,Float:Z;
    new GunID = GetPlayerWeapon(playerid);
    new GunAmmo = GetPlayerAmmo(playerid);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerPos(playerid, X, Y, Z);
    RemovePlayerWeapon(playerid, GunID);
    DropGun(playerid, GunID,GunAmmo,X,Y,Z,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
    format(string, sizeof(string), "* %s drops his weapon to the pavement.", sendername);
    SendLocalMessage(playerid, string, 10.0, COLOR_ACTION, COLOR_ACTION);
    return 1;
}
//=================//
command(pickupgun, playerid, params[])
{
    for(new i = 0; i < sizeof(DropInfo); i++)
    {
        if (IsPlayerInRangeOfPoint(playerid, 2.0,DropInfo[i][DropGunPosX],DropInfo[i][DropGunPosY],DropInfo[i][DropGunPosZ]))
        {
            if(GetPlayerVirtualWorld(playerid) == DropInfo[i][DropGunVWorld] && GetPlayerInterior(playerid) == DropInfo[i][DropGunVWorld])
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                DestroyDynamicObject(DropObject[i]);
                DropInfo[i][DropGunPosX] = 0.0;
                DropInfo[i][DropGunPosY] = 0.0;
                DropInfo[i][DropGunPosZ] = 0.0;
                DropInfo[i][DropGunAmmount][0] = 0;
                DropInfo[i][DropGunAmmount][1] = 0;
                GivePlayerWeapon(playerid,DropInfo[i][DropGunAmmount][0],DropInfo[i][DropGunAmmount][1]);
                format(string, sizeof(string), "* %s picks up a weapon from the pavement.", sendername);
                SendLocalMessage(playerid, string, 10.0, COLOR_ACTION, COLOR_ACTION);
                return 1;
            }
        }
    }
    return 1;
}
//=================//
How i can change it to something like /dropdrugs and it will create dynamic object on the ground?


Re: How to create /drop for items? - lQs - 08.05.2013

Any ideas?


Re: How to create /drop for items? - IceCube! - 08.05.2013

GunPickups = CreatePickup(...); You do need to check if a slot is taken, therefore using an Enum may be more effiicent as you can also retrive information in this case.

OnPlayerPickupPickup - Assign an Array to your pickups (new GunPickups[10]

If thats picked up give them Gun and GunAmmo which was stored in the Enum you created, if YOU made that above you'll understand this. If you never wait for someone to help you write it or goto the script request thread.


Re: How to create /drop for items? - lQs - 08.05.2013

/del


Re: How to create /drop for items? - IceCube! - 08.05.2013

Show me your code to the DropGun function, I will alter that and place my alterations in BOLD, you can then adapt these to drugs.

This forum requires that you wait 120 seconds between posts. Please try again in 26 seconds. (The more active I become the more this happens)


Re: How to create /drop for items? - lQs - 08.05.2013

/del


Re: How to create /drop for items? - IceCube! - 08.05.2013

Okay, gimme 5 minutes... if you want this back annoymously add my skype and remove the code you have shown... Else I will edit this post and allow others to take from it.