Incognito's Streamer question
#1

Why doesn't this delete the pickup?

Global definition:
pawn Код:
new WeaponPID[MAX_DROPPED_WEAPONS];
Creating the pickup:
pawn Код:
CMD:dropwep(playerid, params[])
{
    new
        Float:wepPos[4],
        WeaponID,
        fID = GetOpenWeaponID(),
        WeaponAmmo,
        wepStr[32],
        sendStr[128],
        p_Name[MAX_PLAYER_NAME]
    ;
       
    if(GetPlayerWeapon(playerid) != 0 && GetPlayerAmmo(playerid) != 0) //If they have a weapon..
    {
        GetPlayerPos(playerid, wepPos[0], wepPos[1], wepPos[2]);
        GetPlayerFacingAngle(playerid, wepPos[3]);
        WeaponID = GetPlayerWeapon(playerid);
        WeaponAmmo = GetPlayerAmmo(playerid);
        GetPlayerName(playerid, p_Name, sizeof(p_Name));
       
        format(wepStr, sizeof(wepStr), "RPMod/Weapons/%d.ini", fID);
           
        if(!fexist(wepStr))
        {
            new
                INI:wepFile = INI_Open(wepStr);
                   
            INI_SetTag(wepFile, "weapon");
               
            INI_WriteInt(wepFile, "WeaponID", WeaponID);
            INI_WriteInt(wepFile, "WeaponAmmo", WeaponAmmo);
       
            INI_WriteFloat(wepFile, "WeaponX", wepPos[0]);
            INI_WriteFloat(wepFile, "WeaponY", wepPos[1]);
            INI_WriteFloat(wepFile, "WeaponZ", wepPos[2]);
            INI_WriteFloat(wepFile, "WeaponA", wepPos[3]);
               
            INI_WriteInt(wepFile, "WeaponVirtualWorld", GetPlayerVirtualWorld(playerid));
            INI_WriteInt(wepFile, "WeaponInterior", GetPlayerInterior(playerid));
               
            INI_Close(wepFile);
           
            LoadWeapons();
               
            WeaponPID[fID] = CreateDynamicObject(GetWeaponObjectID(droppedWepInfo[fID][gunID]), droppedWepInfo[fID][gunPos][0], droppedWepInfo[fID][gunPos][1], droppedWepInfo[fID][gunPos][2]-1, 80.0, 0.0, 0.0, droppedWepInfo[fID][gunVirtualWorld]);
               
            format(sendStr, sizeof(sendStr), ""#PURPLE"* "#LIME"%s "#PURPLE"has dropped a weapon.", p_Name);
            ProxDetector(20.0, playerid, sendStr, c_PURPLE, c_PURPLE, c_PURPLE, c_PURPLE, c_PURPLE);   
           
            RemovePlayerWeapon(playerid, WeaponID);
           
        }
    }
    return 1;
}
Keystate:
pawn Код:
for( new w; w < MAX_DROPPED_WEAPONS; w++ )
        {
            if(IsPlayerInRangeOfPoint(playerid, 1, droppedWepInfo[w][gunPos][0], droppedWepInfo[w][gunPos][1], droppedWepInfo[w][gunPos][2]))
            {
                if(GetPlayerVirtualWorld(playerid) == droppedWepInfo[w][gunVirtualWorld] && GetPlayerInterior(playerid) == droppedWepInfo[w][gunInterior])
                {
                    new
                        wepStr[32];
                       
                    format(wepStr, sizeof(wepStr), "RPMod/Weapons/%d.ini", w);
                   
                    GivePlayerWeapon(playerid, droppedWepInfo[w][gunID], droppedWepInfo[w][gunAmmo]);
                    DestroyDynamicPickup(WeaponPID[w]);
                   
                    fremove(wepStr);
                   
                    LoadWeapons();
                }
            }
        }
Reply


Messages In This Thread
Incognito's Streamer question - by 2KY - 23.02.2012, 01:06
Re: Incognito's Streamer question - by coole210 - 23.02.2012, 01:48
Re: Incognito's Streamer question - by 2KY - 23.02.2012, 03:03
Re: Incognito's Streamer question - by MP2 - 23.02.2012, 04:55
Re: Incognito's Streamer question - by 2KY - 23.02.2012, 05:53

Forum Jump:


Users browsing this thread: 1 Guest(s)