drop gun problem
#1

When i drop the gun is wont come up on the ground

pawn Код:
COMMAND:dropgun(playerid, params[])
{
    if(PlayerInfo[playerid][pConnectTime] < 3)
    {
        return SendClientMessage(playerid, COLOR_GREY, " This command is restricted to: TLS 3 and above");
    }
    if (GetPlayerWeapon(playerid) < 2 || GetPlayerWeapon(playerid) > 34)
    {
         SendClientMessage(playerid, COLOR_GREY, " You cannot drop this weapon !");
         return 1;
    }

    new Float:PlayersHealth;
    GetPlayerHealth(playerid, PlayersHealth);
    if (PlayersHealth == 0.0)
    {
          SendClientMessage(playerid, COLOR_GREY, " You have no access to drop this weapon at your health !");
          return 1;
    }
    new giveplayerid;
    new gunID = GetPlayerWeapon(playerid);
    new gunAmmo = GetPlayerAmmo(playerid);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    RemovePlayerWeaponEx(playerid, gunID);
    SendClientMessage(playerid, COLOR_GREY, " You dropped your weapon onto the ground.");
    DropWeapons(gunID,gunAmmo,x,y,z,GetPlayerVirtualWorld(playerid),playerid);
    if(PlayerInfo[playerid][pSex] == 1)
    {
        PlayerPlayerActionMessage(playerid,giveplayerid,20.0,"drops his weapon to the ground.");
    } else {
        PlayerPlayerActionMessage(playerid,giveplayerid,20.0,"drops her weapon to the ground.");
    }
    return 1;
}
Reply
#2

Where's the Create Pickup of the weapon? I just see you dropped it..
Reply
#3

pawn Код:
stock DropWeapons(gunID,gunAmmo,Float:X,Float:Y,Float:Z,world,playerid)
{
    if(IsADisabledWeapon(playerid,gunID))
    {
        return 1;
    }
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(gunID != 0 && gunAmmo != 0)
    {
        for(new i = 0; i < sizeof(DropInfo); i++)
        {
            if(DropInfo[i][dx] == 0.0 && DropInfo[i][dy] == 0.0 && DropInfo[i][dz] == 0.0)
            {
                DropInfo[i][dType] = 1;
                DropInfo[i][dAmount][0] = gunID;
                DropInfo[i][dAmount][1] = gunAmmo;
                DropInfo[i][dx] = X;
                DropInfo[i][dy] = Y;
                DropInfo[i][dz] = Z;
                DropInfo[i][dWorld] = world;
                strcpy(DropInfo[i][dPlayerName],name,MAX_PLAYER_NAME);
                DropObject[i] = CreateDynamicObject(gh_GetObjectID(gunID), X, Y, Z-1, 80.0, 0.0, 0.0, world);
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
pawn Код:
enum dInfo
{
    dType,
    dAmount[2],
    Float:dx,
    Float:dy,
    Float:dz,
    dWorld,
    dPlayerName[MAX_PLAYER_NAME],
};

new DropInfo[500][dInfo];
Reply
#4

Already got it here is mine

pawn Код:
}
stock DropWeapons(gunID,gunAmmo,Float:x,Float:y,Float:z,world,playerid)
{
    if(IsADisabledWeapon(playerid,gunID))
    {
        return 1;
    }
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(gunID != 0 && gunAmmo != 0)
    {
        for(new i = 0; i < sizeof(DropInfo); i++)
        {
            if(DropInfo[playerid][dox] == 0.0 && DropInfo[playerid][doy] == 0.0 && DropInfo[playerid][doz] == 0.0)
            {
                DropInfo[playerid][dType] = 1;
                DropInfo[playerid][dAmount][0] = gunID;
                DropInfo[playerid][dAmount][1] = gunAmmo;
                DropInfo[playerid][dox] = x;
                DropInfo[playerid][doy] = y;
                DropInfo[playerid][doz] = z;
                DropInfo[playerid][dWorld] = world;
                strcpy(DropInfo[playerid][dPlayerName],name,MAX_PLAYER_NAME);
                DropObject[playerid] = CreateDynamicObject(gh_GetObjectID(gunID), z, y, z-1, 80.0, 0.0, 0.0, world);
                return 1;
            }
        }
        return 1;
    }
    return 1;
Reply
#5

pawn Код:
DropObject[playerid] = CreateDynamicObject(gh_GetObjectID(gunID), x, y, z-1, 80.0, 0.0, 0.0, world);
Reply
#6

DropObject[playerid] = CreateDynamicObject(gh_GetObjectID(gunID), z, y, z-1, 80.0, 0.0, 0.0, world);

Where's the x ?
Reply
#7

Quote:
Originally Posted by Firo
Посмотреть сообщение
DropObject[playerid] = CreateDynamicObject(gh_GetObjectID(gunID), z, y, z-1, 80.0, 0.0, 0.0, world);

Where's the x ?
Lol i miss the x, now is fixed.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)