SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/10/2015, 11:12 AM   #1
N0FeaR
High-roller
 
N0FeaR's Avatar
 
Join Date: Nov 2011
Location: Los Santos, Idlewood
Posts: 2,337
Reputation: 155
Question Drop gun help

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

PHP Code:
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 Code:
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;

__________________
Check out this sh*t

N0FeaR is offline   Reply With Quote
Old 15/10/2015, 01:17 PM   #2
Morpheine
Big Clucker
 
Morpheine's Avatar
 
Join Date: Feb 2015
Location: Romania.
Posts: 120
Reputation: 4
Default Re: Drop gun help

CreatePickup(GetGunObjectID, x, x, etc) it working?
Morpheine is offline   Reply With Quote
Old 15/10/2015, 01:34 PM   #3
N0FeaR
High-roller
 
N0FeaR's Avatar
 
Join Date: Nov 2011
Location: Los Santos, Idlewood
Posts: 2,337
Reputation: 155
Default Re: Drop gun help

Quote:
Originally Posted by Morpheine View Post
CreatePickup(GetGunObjectID, x, x, etc) it working?
Nah!
__________________
Check out this sh*t

N0FeaR is offline   Reply With Quote
Old 15/10/2015, 02:33 PM   #4
thefirestate
Big Clucker
 
Join Date: Sep 2014
Location: Bulgaria
Posts: 172
Reputation: 10
Default Re: Drop gun help

I need you to add printf("%f %f %f", X , Y , Z); and tell me it's values.
thefirestate is offline   Reply With Quote
Old 16/10/2015, 05:45 AM   #5
N0FeaR
High-roller
 
N0FeaR's Avatar
 
Join Date: Nov 2011
Location: Los Santos, Idlewood
Posts: 2,337
Reputation: 155
Default Re: Drop gun help

Quote:
Originally Posted by thefirestate View Post
I need you to add printf("%f %f %f", X , Y , Z); and tell me it's values.

You could explain better!
__________________
Check out this sh*t

N0FeaR is offline   Reply With Quote
Old 16/10/2015, 06:22 AM   #6
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,792
Reputation: 822
Default Re: Drop gun help

Does this gets printed in your console ?
pawn Code:
format(string, sizeof(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);
__________________

My GitHub:

Gammix is offline   Reply With Quote
Old 16/10/2015, 10:25 PM   #7
N0FeaR
High-roller
 
N0FeaR's Avatar
 
Join Date: Nov 2011
Location: Los Santos, Idlewood
Posts: 2,337
Reputation: 155
Default Re: Drop gun help

Quote:
Originally Posted by Gammix View Post
Does this gets printed in your console ?
pawn Code:
format(string, sizeof(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);
Nah..
__________________
Check out this sh*t

N0FeaR is offline   Reply With Quote
Old 17/10/2015, 06:26 AM   #8
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,792
Reputation: 822
Default Re: Drop gun help

So this clearly states that these checks
pawn Code:
new string[128];
    if(gunID != 0 && gunAmmo != 0 && ValidDropGunID(gunID))
    {
        for(new i = 0; i < sizeof(DropInfo); i++)
          {
              if(DropInfo[i][dX] == 0.0 && DropInfo[i][dY] == 0.0 && DropInfo[i][dZ] == 0.0)
              {

Are not letting you create a pickup/weapon drop.
__________________

My GitHub:

Gammix is offline   Reply With Quote
Old 25/11/2015, 04:12 PM   #9
N0FeaR
High-roller
 
N0FeaR's Avatar
 
Join Date: Nov 2011
Location: Los Santos, Idlewood
Posts: 2,337
Reputation: 155
Default Re: Drop gun help

anyone be able to help?
__________________
Check out this sh*t

N0FeaR is offline   Reply With Quote
Old 25/11/2015, 05:13 PM   #10
CmZxC
Huge Clucker
 
CmZxC's Avatar
 
Join Date: Apr 2011
Location: Notepad++ ; pawncc.exe
Posts: 375
Reputation: 35
Default Re: Drop gun help

Can you add debug lines to each check to see how far it gets?

PHP Code:
    print("1/4");
    if(
gunID != && gunAmmo != && ValidDropGunID(gunID)) 
    {
        print(
"2/4");
        for(new 
0sizeof(DropInfo); i++) 
        {
            print(
"3/4");
            if(
DropInfo[i][dX] == 0.0 && DropInfo[i][dY] == 0.0 && DropInfo[i][dZ] == 0.0
            {
                print(
"4/4"); 
and then tell us how far did it get?
__________________
Boo-hoo.
CmZxC is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Drop Gun PeteShag Filterscripts 90 09/03/2018 10:20 AM
[FilterScript] Drop Gun Darkwood Filterscripts 11 24/06/2012 07:58 AM
0.3a FPS drop. agnestort Client Support 2 22/10/2009 12:52 PM


All times are GMT. The time now is 01:44 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.