error 079: inconsistent return types (array & non-array)
#1

Can anyone help with this?
(7806) : error 079: inconsistent return types (array & non-array)
Код:
stock PickupGun(weaponid)
{
    if (weaponid < 0 || weaponid > 64)
    {
        return 0;
    }
    return GunObjects[weaponid];
}
(782 : error 035: argument type mismatch (argument 1)
Код:
GunObject[i] = CreateDynamicObject(PickupGun(weaponid), X, Y, Z-1, 80.0, 0.0, 0.0, VirtualWorld);
Reply
#2

on stock you should make (playerid), then in the stock GetPlayerWeaponID, and finish all with return 1;
Reply
#3

try this code:
Код:
PickupGun(weaponid);
if(GunObjects[weaponid] != -1)
{
GunObject[i] = CreateDynamicObject(GunObjects[weaponid], X, Y, Z-1, 80.0, 0.0, 0.0, VirtualWorld, -1, -1, 200.0);
}
Код:
stock PickupGun(weaponid)
{
    if (weaponid < 0 || weaponid > 64)
    {
        GunObjects[weaponid] = -1;
    }
    else
    {
        GunObjects[weaponid] = weaponid;
    }
    return 1;
}
Reply
#4

(7805) : error 033: array must be indexed (variable "GunObjects")
(7809) : error 033: array must be indexed (variable "GunObjects")
(7832) : error 033: array must be indexed (variable "GunObjects")
(7834) : error 035: argument type mismatch (argument 1)

This is the full code.. I am getting messed up..

Код:
stock PickupGun(weaponid)
{
    if (weaponid < 0 || weaponid > 64)
    {
        GunObjects[weaponid] = -1;
    }
    else
    {
        GunObjects[weaponid] = weaponid;
    }
    return 1;
}

stock DropGun(playerid,weaponid,weaponammo,Float:X,Float:Y,Float:Z,VirtualWorld,Interior)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(weaponid != 0 && weaponid != 0)
    {
        for(new i = 0; i < sizeof(wInfo); i++)
        {
            if(wInfo[i][GunPosX] == 0.0 && wInfo[i][GunPosY] == 0.0 && wInfo[i][GunPosZ] == 0.0)
            {
                wInfo[i][GunAmount][0] = weaponid;
                wInfo[i][GunAmount][1] = weaponammo;
                wInfo[i][GunPosX] = X;
                wInfo[i][GunPosY] = Y;
                wInfo[i][GunPosZ] = Z;
                wInfo[i][GunWorld] = VirtualWorld;
                wInfo[i][GunInterior] = Interior;
                PickupGun(weaponid);
				if(GunObjects[weaponid] != -1)
				{
				GunObject[i] = CreateDynamicObject(GunObjects[weaponid], X, Y, Z-1, 80.0, 0.0, 0.0, VirtualWorld, -1, -1, 200.0);
				}
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
Reply
#5

How do you define GunObjects?
Reply
#6

Quote:
Originally Posted by Jamester
Посмотреть сообщение
How do you define GunObjects?
new GunObjects[47][0] = {
{0},
{331},
{333},
{334},
{335},
{336},
{337},
{338},
{339},
{341},
{321},
{322},
{323},
{324},
{325},
{326},
{342},
{343},
{344},
{0},
{0},
{0},
{346},
{347},
{348},
{349},
{350},
{351},
{352},
{353},
{355},
{356},
{372},
{357},
{358},
{359},
{360},
{361},
{362},
{363},
{364},
{365},
{366},
{367},
{368},
{368},
{371}
};
Reply
#7

u should try this:
Код:
new GunObjectIDs[200] ={

   1575,  331, 333, 334, 335, 336, 337, 338, 339, 341, 321, 322, 323, 324, 325, 326, 342, 343, 344, -1,  -1 , -1 ,
   346, 347, 348, 349, 350, 351, 352, 353, 355, 356, 372, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367,
   368, 369, 1575
};

stock GetGunObjectID(WeaponID)
{
    if (WeaponID < 0 || WeaponID > 64)
    {
        return 1575;
    }
    return GunObjectIDs[WeaponID];
}

stock DropGun(playerid,weaponid,weaponammo,Float:X,Float:Y,Float:Z,VirtualWorld,Interior)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(weaponid != 0 && weaponid != 0)
    {
        for(new i = 0; i < sizeof(wInfo); i++)
        {
            if(wInfo[i][GunPosX] == 0.0 && wInfo[i][GunPosY] == 0.0 && wInfo[i][GunPosZ] == 0.0)
            {
                wInfo[i][GunAmount][0] = weaponid;
                wInfo[i][GunAmount][1] = weaponammo;
                wInfo[i][GunPosX] = X;
                wInfo[i][GunPosY] = Y;
                wInfo[i][GunPosZ] = Z;
                wInfo[i][GunWorld] = VirtualWorld;
                wInfo[i][GunInterior] = Interior;
                PickupGun(weaponid);
		GunObject[i] = CreateDynamicObject(GetGunObjectID(weaponid), X, Y, Z-1, 80.0, 0.0, 0.0, VirtualWorld);
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
Reply
#8

PHP код:
GunObjects[47][0] <-- Your array
GunObject[i] = CreateDynamicObject <-- Trying to use array in a DynamicObject 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)