SA-MP Forums Archive
CreateDynamicObject issue (I Think). - 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: CreateDynamicObject issue (I Think). (/showthread.php?tid=417374)



CreateDynamicObject issue (I Think). - Dokins - 21.02.2013

Hi, basically the only issue is that the object doesn't get created and I don't know why.

pawn Код:
CMD:dropgun(playerid, params[])
{
    new Float:x,Float:y,Float:z, string[128];
    new GunID = GetPlayerWeapon(playerid);
    new GunAmmo = GetPlayerAmmo(playerid);
    if(GunID < 1) return SendClientMessage(playerid, COLOUR_GREY, "You do not have any weapons to drop.");
    GetPlayerPos(playerid, x, y, z);
    RemovePlayerWeapon(playerid, GunID);
    DropGun(playerid, GunID,GunAmmo,x,y,z,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
    format(string, sizeof(string), "* %s has dropped their weapon.", GetNameEx(playerid));
    ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
    return 1;
}
pawn Код:
stock DropGun(playerid, GunID, GunAmmo, Float:x, Float:y, Float:z, world, interior)
{
    if(GunID != 0 && GunAmmo != 0)
    {
        for(new i = 1; i < MAX_DROP_ITEMS; i++)
        {
            if(DropGunX[i] == 0.0 && DropGunY[i] == 0.0 && DropGunZ[i] == 0.0)
            {
                DropGunID[i] = GunID;
                DropGunAmmo[i] = GunAmmo;
                DropGunX[i] = x;
                DropGunY[i] = y;
                DropGunZ[i] = z;
                DropGunVW[i] = world;
                DropGunInterior[i] = interior;
                DropObject[i] = CreateDynamicObject(GetGunObjectID(GunID), x, y, z, 80.0, 0.0, 0.0, world, interior, INVALID_PLAYER_ID, 200.0);
                printf("GunObjectID: %d", GetGunObjectID(GunID));
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
Everything works, I can go and pick it up etc, There is just no object. I've updated to the latest streamer, provided by Incognito, 0.3x version and I've even updated the include file.