/drop gun help?
#1

I made an drop gun system but when i drop the gun is not visible on the ground thanks in advance!

PHP код:
if(strcmp(type"gun"true) == 0)
        {
            if (
GetPVarInt(playerid"PlayerLogged") == 0) return SendClientMessage(playeridCOLOR_WHITE"You must be logged in to use this.");
            if(
GetPlayerWeapon(playerid) == 0) return SendClientMessage(playeridCOLOR_WHITE"This is not a valid weapon.");
            if (
PlayerWeapons[playerid][GetPlayerWeapon(playerid)] == 0) return SendClientMessage(playeridCOLOR_LIGHTRED"The weapon you currently have in your hand is labeld a Hacked Weapon, You are either SA-MP Bugged or Cheating !");
            if(
GetPlayerAmmo(playerid) == 0) return SendClientMessage(playeridCOLOR_WHITE"You do not have enough ammo to drop this weapon.");
            if (
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_LIGHTRED"You can't be in a vehicle while you use this !");
            
//if(GetPVarInt(playerid, "GunLic") == 1 && ResWeapon(GetPlayerWeapon(playerid))) return SendClientMessage(playerid, COLOR_GREY ,"Ammunation weapons can not be distributed.");
            
new gunname[128], gunid GetPlayerWeapon(playerid), gunammo GetPlayerAmmo(playerid);
            
GetWeaponName(GetPlayerWeapon(playerid), gunnamesizeof(gunname));
            
format(stringsizeof(string), "*** %s drops %s %s on the ground."sendernameCheckSex(playerid),gunname);
            
ProxDetector(30.0playeridstringCOLOR_PURPLE);
            
GetPlayerPos(playerid,X,Y,Z);
            
RemovePlayerWeaponEx(playeridGetPlayerWeapon(playerid));
            if(
GetPVarInt(playerid"Gloves") == 1sendername="Unknown";
            if(
GetPVarInt(playerid"Member") != && GetPVarInt(playerid"Member") != 7)
            {
                new 
amount2 0;
                for(new 
0sizeof(DropInfo); i++)
                  {
                      if(
strcmp(PlayerName(playerid), DropInfo[i][dOwner], true) == 0)
                      {
                          
amount2++;
                      }
                  }
                  if(
amount2 <= 1DropWeapons(gunid,gunammo,X,Y,Z,GetPlayerVirtualWorld(playerid),PlayerName(playerid),sendername); 
stock
PHP код:
stock DropWeapons(gunID,gunAmmo,Float:X,Float:Y,Float:Z,world,owner[],print[])
{
    new 
string[128];
    if(
gunID != && gunAmmo != && ValidDropGunID(gunID))
    {
        for(new 
0sizeof(DropInfo); i++)
          {
              if(
DropInfo[i][dX] == 0.0 && DropInfo[i][dY] == 0.0 && DropInfo[i][dZ] == 0.0)
              {
                  
strmid(DropInfo[i][dOwner], owner0strlen(owner), 255);
                  
strmid(DropInfo[i][dPrint], print, 0strlen(print), 255);
                  
DropInfo[i][dWeapon] = gunID;
                  
DropInfo[i][dAmmo] = gunAmmo;
                  
DropInfo[i][dX] = X;
                  
DropInfo[i][dY] = Y;
                  
DropInfo[i][dZ] = Z;
                  
DropInfo[i][dWorld] = world;
                  
DropInfo[i][dType] = 1;
                  
DropInfo[i][dObject] = CreateDynamicObject(GetGunObjectID(gunID), XYZ-180.00.00.0world);
                  
format(stringsizeof(string),"[DEBUG]: Gun Object: %d spawned using Weapon-ID: %d | Ammo-ID: %d | World %d",i,DropInfo[i][dWeapon],DropInfo[i][dAmmo],DropInfo[i][dWorld]);
                  
printf(string);
                return 
1;
              }
        }
    }
    return 
1;

Reply
#2

Why don't you make a Weapon Icon Pickup instead of object?
Reply
#3

I don't really understand but try this

PHP код:
new GunObjects[47][0] = { // EDIT THIS AS YOU LIKE
{0},// Emty
{331},// Brass Knuckles
{333},// Golf Club
{334},// Nitestick
{335},// Knife
{336},// Baseball Bat
{337},// Showel
{338},// Pool Cue
{339},// Katana
{341},// Chainsaw
{321},// Purple Dildo
{322},// Small White Dildo
{323},// Long White Dildo
{324},// Vibrator
{325},// Flowers
{326},// Cane
{342},// Grenade
{343},// Tear Gas
{344},// Molotov
{0},
{
0},
{
0},
{
346},// Glock
{347},// Silenced Colt
{348},// Desert Eagle
{349},// Shotgun
{350},// Sawn Off
{351},// Combat Shotgun
{352},// Micro UZI
{353},// MP5
{355},// AK47
{356},// M4
{372},// Tec9
{357},// Rifle
{358},// Sniper Rifle
{359},// Rocket Launcher
{360},// HS Rocket Launcher
{361},// Flamethrower
{362},// Minigun
{363},// Detonator
{364},// Detonator Button
{365},// Spraycan
{366},// Fire suisher
{367},// Camera
{368},// Nightvision
{368},// Infrared Vision
{371}// Parachute
};
new 
Float:ObjCoords[100][3];
new 
object[100];
new 
ObjectID[100][2];
forward DeleteGun(objectid);
public 
DeleteGun(objectid)
{
    
DestroyDynamicObject(objectid);
    new 
100+1;
    for(new 
0sizeof(ObjCoords); a++)
    {
        
a;
        break;
    }
    
ObjCoords[f][0] = 0.0;
    
ObjCoords[f][1] = 0.0;
    
ObjCoords[f][2] = 0.0;
    return 
1;

Reply
#4

Or this
PHP код:
    else if(strcmp(choice,"guns",true) == 0)
    {
        if(
GetPVarInt(playerid"PBM") > 0)
        {
            
SendClientMessage(playeridCOLOR_WHITE"You're not able to do this while in a paintball game.");
            return 
1;
        }
        if(
GetPVarInt(playerid"EventToken") != 0)
        {
            
SendClientMessage(playeridCOLOR_GREY"You can't use this while you're in an event.");
            return 
1;
        }
        
PlayerPlaySound(playerid10520.00.00.0);
        
ResetPlayerWeaponsEx(playerid);
        
format(stringsizeof(string), "* %s has thrown away their Weapons."GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    } 
Or just use a single command I don't really understand what do you mean
PHP код:
CMD:dropgun(playeridparams[])
{
    if(
IsPlayerInAnyVehicle(playerid)) {
        
SendClientMessageEx (playeridCOLOR_GRAD2"You can not drop weapons in a vehicle!");
        return 
1;
    }
    new 
gunid GetPlayerWeapon(playerid);
    if(
gunid) {
        new 
100+1;
        for(new 
0sizeof(ObjCoords); a++) {
            if(
ObjCoords[a][0] == 0.0) {
                
a;
                break;
            }
        }
        if(
100) return SendClientMessage(playeridCOLOR_GREY"You can not throw weapons at the moment, try back later!!");
        new 
WeaponName[65], sendername[MAX_PLAYER_NAME];
        new 
string[128];
        
GetPlayerName(playeridsendernamesizeof(sendername));
        
GetWeaponName(gunidWeaponName64);
        if(
gunid == 18) { WeaponName "Molotovs"; }
        if(
gunid == 44) { WeaponName "Nightvision Goggles"; }
        if(
gunid == 45) { WeaponName "Infared Goggles"; }
        
RemovePlayerWeapon(playerid,gunid);
        
ObjectID[f][0] = gunid;
        
GetPlayerPos(playeridObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
        
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1100.0);
        
SetTimerEx("DeleteGun"5000000"d"object[f]);
        
format(stringsizeof(string), "* %s has thrown away their %s."sendernameWeaponName);
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"You Don't have guns");
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by XBrianX
Посмотреть сообщение
Or this
PHP код:
    else if(strcmp(choice,"guns",true) == 0)
    {
        if(
GetPVarInt(playerid"PBM") > 0)
        {
            
SendClientMessage(playeridCOLOR_WHITE"You're not able to do this while in a paintball game.");
            return 
1;
        }
        if(
GetPVarInt(playerid"EventToken") != 0)
        {
            
SendClientMessage(playeridCOLOR_GREY"You can't use this while you're in an event.");
            return 
1;
        }
        
PlayerPlaySound(playerid10520.00.00.0);
        
ResetPlayerWeaponsEx(playerid);
        
format(stringsizeof(string), "* %s has thrown away their Weapons."GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    } 
Or just use a single command I don't really understand what do you mean
PHP код:
CMD:dropgun(playeridparams[])
{
    if(
IsPlayerInAnyVehicle(playerid)) {
        
SendClientMessageEx (playeridCOLOR_GRAD2"You can not drop weapons in a vehicle!");
        return 
1;
    }
    new 
gunid GetPlayerWeapon(playerid);
    if(
gunid) {
        new 
100+1;
        for(new 
0sizeof(ObjCoords); a++) {
            if(
ObjCoords[a][0] == 0.0) {
                
a;
                break;
            }
        }
        if(
100) return SendClientMessage(playeridCOLOR_GREY"You can not throw weapons at the moment, try back later!!");
        new 
WeaponName[65], sendername[MAX_PLAYER_NAME];
        new 
string[128];
        
GetPlayerName(playeridsendernamesizeof(sendername));
        
GetWeaponName(gunidWeaponName64);
        if(
gunid == 18) { WeaponName "Molotovs"; }
        if(
gunid == 44) { WeaponName "Nightvision Goggles"; }
        if(
gunid == 45) { WeaponName "Infared Goggles"; }
        
RemovePlayerWeapon(playerid,gunid);
        
ObjectID[f][0] = gunid;
        
GetPlayerPos(playeridObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
        
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1100.0);
        
SetTimerEx("DeleteGun"5000000"d"object[f]);
        
format(stringsizeof(string), "* %s has thrown away their %s."sendernameWeaponName);
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"You Don't have guns");
    }
    return 
1;

Using a single command won't change anything (unless a value is being passed incorrectly), it just makes the code look more congested. It also seems that it's likely to be called elsewhere; there is nothing wrong with the presented layout. Check if the weapon is actually being created or if it's just too low to see.

Use something like this after the CreateDynamicObject line:
pawn Код:
if(IsValidDynamicObject(DropInfo[i][dObject]))
{
      print("created");
}

else
{
      print("not created");
}
Reply
#6

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Using a single command won't change anything (unless a value is being passed incorrectly), it just makes the code look more congested. It also seems that it's likely to be called elsewhere; there is nothing wrong with the presented layout. Check if the weapon is actually being created or if it's just too low to see.

Use something like this after the CreateDynamicObject line:
pawn Код:
if(IsValidDynamicObject(DropInfo[i][dObject]))
{
      print("created");
}

else
{
      print("not created");
}
I didnt create anything, cus i have made any drop weed system and thats working perfect also have a cmd to pickup stuff and i can pickup the weed but not the gun
Reply
#7

here is the drop for weed and thats working!

PHP код:
else if(strcmp(type"weed"true) == 0)
        {
            if (
GetPVarInt(playerid"PlayerLogged") == 0) return SendClientMessage(playeridCOLOR_WHITE"You must be logged in to use this.");
            if (
GetPVarInt(playerid"Weed") == 0) return SendClientMessage(playeridCOLOR_WHITE"You don't have any weed on you.");
            if (
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_LIGHTRED"You can't be in a vehicle while you use this !");
            
SendClientMessage(playeridCOLOR_WHITE"You dropped your weed onto the ground.");
            
GetPlayerPos(playerid,X,Y,Z);
            new 
amount2 0amounto GetPVarInt(playerid"Weed");
            
SetPVarInt(playerid"Weed"0);
            for(new 
0sizeof(DropInfo); i++)
              {
                  if(
strcmp(PlayerName(playerid), DropInfo[i][dOwner], true) == 0)
                  {
                      
amount2++;
                  }
              }
           if(
amount2 <= 2)
           {
               for(new 
0sizeof(DropInfo); i++)
                 {
                     if(
DropInfo[i][dX] == 0.0 && DropInfo[i][dY] == 0.0 && DropInfo[i][dZ] == 0.0)
                   {
                         
strmid(DropInfo[i][dOwner], PlayerName(playerid), 0strlen(PlayerName(playerid)), 255);
                         
DropInfo[i][dAmmo] = amounto;
                         
DropInfo[i][dX] = X;
                         
DropInfo[i][dY] = Y;
                         
DropInfo[i][dZ] = Z;
                         
DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
                         
DropInfo[i][dType] = 2;
                         
DropInfo[i][dObject] = CreateDynamicObject(1578XYZ-10.00.00.0GetPlayerVirtualWorld(playerid));
                       return 
1
Reply
#8

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
here is the drop for weed and thats working!

PHP код:
else if(strcmp(type"weed"true) == 0)
        {
            if (
GetPVarInt(playerid"PlayerLogged") == 0) return SendClientMessage(playeridCOLOR_WHITE"You must be logged in to use this.");
            if (
GetPVarInt(playerid"Weed") == 0) return SendClientMessage(playeridCOLOR_WHITE"You don't have any weed on you.");
            if (
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_LIGHTRED"You can't be in a vehicle while you use this !");
            
SendClientMessage(playeridCOLOR_WHITE"You dropped your weed onto the ground.");
            
GetPlayerPos(playerid,X,Y,Z);
            new 
amount2 0amounto GetPVarInt(playerid"Weed");
            
SetPVarInt(playerid"Weed"0);
            for(new 
0sizeof(DropInfo); i++)
              {
                  if(
strcmp(PlayerName(playerid), DropInfo[i][dOwner], true) == 0)
                  {
                      
amount2++;
                  }
              }
           if(
amount2 <= 2)
           {
               for(new 
0sizeof(DropInfo); i++)
                 {
                     if(
DropInfo[i][dX] == 0.0 && DropInfo[i][dY] == 0.0 && DropInfo[i][dZ] == 0.0)
                   {
                         
strmid(DropInfo[i][dOwner], PlayerName(playerid), 0strlen(PlayerName(playerid)), 255);
                         
DropInfo[i][dAmmo] = amounto;
                         
DropInfo[i][dX] = X;
                         
DropInfo[i][dY] = Y;
                         
DropInfo[i][dZ] = Z;
                         
DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
                         
DropInfo[i][dType] = 2;
                         
DropInfo[i][dObject] = CreateDynamicObject(1578XYZ-10.00.00.0GetPlayerVirtualWorld(playerid));
                       return 
1
Try using my command:

PHP код:
CMD:dropgun(playeridparams[]) 

    if(
IsPlayerInAnyVehicle(playerid)) { 
        
SendClientMessageEx (playeridCOLOR_GRAD2"You can not drop weapons in a vehicle!"); 
        return 
1
    } 
    new 
gunid GetPlayerWeapon(playerid); 
    if(
gunid) { 
        new 
100+1
        for(new 
0sizeof(ObjCoords); a++) { 
            if(
ObjCoords[a][0] == 0.0) { 
                
a
                break; 
            } 
        } 
        if(
100) return SendClientMessage(playeridCOLOR_GREY"You can not throw weapons at the moment, try back later!!"); 
        new 
WeaponName[65], sendername[MAX_PLAYER_NAME]; 
        new 
string[128]; 
        
GetPlayerName(playeridsendernamesizeof(sendername)); 
        
GetWeaponName(gunidWeaponName64); 
        if(
gunid == 18) { WeaponName "Molotovs"; } 
        if(
gunid == 44) { WeaponName "Nightvision Goggles"; } 
        if(
gunid == 45) { WeaponName "Infared Goggles"; } 
        
RemovePlayerWeapon(playerid,gunid); 
        
ObjectID[f][0] = gunid
        
GetPlayerPos(playeridObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]); 
        
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1100.0); 
        
SetTimerEx("DeleteGun"5000000"d"object[f]); 
        
format(stringsizeof(string), "* %s has thrown away their %s."sendernameWeaponName); 
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); 
        } 
    else 
    { 
        
SendClientMessageEx(playeridCOLOR_GRAD1"You Don't have guns"); 
    } 
    return 
1

I'm sure it'll work because sets the weapon on ground position.
PHP код:
 GetPlayerPos(playeridObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]); 
        
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1100.0); 
Reply
#9

Quote:
Originally Posted by XBrianX
Посмотреть сообщение
Try using my command:

PHP код:
CMD:dropgun(playeridparams[]) 

    if(
IsPlayerInAnyVehicle(playerid)) { 
        
SendClientMessageEx (playeridCOLOR_GRAD2"You can not drop weapons in a vehicle!"); 
        return 
1
    } 
    new 
gunid GetPlayerWeapon(playerid); 
    if(
gunid) { 
        new 
100+1
        for(new 
0sizeof(ObjCoords); a++) { 
            if(
ObjCoords[a][0] == 0.0) { 
                
a
                break; 
            } 
        } 
        if(
100) return SendClientMessage(playeridCOLOR_GREY"You can not throw weapons at the moment, try back later!!"); 
        new 
WeaponName[65], sendername[MAX_PLAYER_NAME]; 
        new 
string[128]; 
        
GetPlayerName(playeridsendernamesizeof(sendername)); 
        
GetWeaponName(gunidWeaponName64); 
        if(
gunid == 18) { WeaponName "Molotovs"; } 
        if(
gunid == 44) { WeaponName "Nightvision Goggles"; } 
        if(
gunid == 45) { WeaponName "Infared Goggles"; } 
        
RemovePlayerWeapon(playerid,gunid); 
        
ObjectID[f][0] = gunid
        
GetPlayerPos(playeridObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]); 
        
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1100.0); 
        
SetTimerEx("DeleteGun"5000000"d"object[f]); 
        
format(stringsizeof(string), "* %s has thrown away their %s."sendernameWeaponName); 
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); 
        } 
    else 
    { 
        
SendClientMessageEx(playeridCOLOR_GRAD1"You Don't have guns"); 
    } 
    return 
1

I'm sure it'll work because sets the weapon on ground position.
PHP код:
 GetPlayerPos(playeridObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]); 
        
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1100.0); 
I will try to fix mine, thanks anyway
Reply
#10

BUMP. someone can help me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)