SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 10/05/2010, 11:59 PM   #1
MatthewGarrowo
Big Clucker
 
Join Date: Dec 2009
Posts: 173
Reputation: 0
Default {HELP} /dropgun command

i put in a /dropgun command but how do i put in a /pickup command becuse i need to be able to pick up the gun form the ground and when i put /dropgun it disapears i want it to be on the ground so i can see it
heres my code


if (strcmp("/dropgun", cmdtext, true, 10) == 0)
{
if(GetPlayerWeapon(playerid) == 0) return SendClientMessage(playerid,0xFF0000FF,"You haven't gun in Your hand.");
new name[MAX_PLAYER_NAME],msg[128],Float,Float:y,Float:z;
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
GetPlayerPos(playerid,x,y,z);
new WhatGun = GetPlayerWeapon(playerid);
new HowMuch = GetPlayerAmmo(playerid);
GivePlayerWeapon(playerid,WhatGun,-HowMuch);
format(msg,128,"%s has dropped his/her weapon on the floor.",name);
for(new i=0;i<MAX_PLAYERS;i++){
if(IsPlayerConnected(playerid)){
if(IsPlayerInRangeOfPoint(i,15,x,y,z)){
SendClientMessage(i,0xC2A2DAAA,msg);
}
}
}
return 1;
}
MatthewGarrowo is offline  
Old 11/05/2010, 12:10 AM   #2
mansonh
Gangsta
 
Join Date: Jun 2009
Posts: 602
Reputation: 0
Default Re: {HELP} /dropgun command

You have a couple of options.

You need to look up the weapons object (suggest using mta map editor to find all guns you us)

Then create the gun object on the floor. And save the gun position etc to variables so when someone does /pickup you can check if they are near a gun.

Or you can do it the easier way, and create a pickup object of the gun. Then use the onplayerpickup system
__________________
mansonh is offline  
Old 11/05/2010, 12:15 AM   #3
MatthewGarrowo
Big Clucker
 
Join Date: Dec 2009
Posts: 173
Reputation: 0
Default Re: {HELP} /dropgun command

can you just do a /pickupgun command and it will pick up the gun near you and the gun will show up on the groudn when you type /dropgun
MatthewGarrowo is offline  
Old 11/05/2010, 02:15 AM   #4
mansonh
Gangsta
 
Join Date: Jun 2009
Posts: 602
Reputation: 0
Default Re: {HELP} /dropgun command

Its not a simple command, and I don't have samp to check the objects.

Its not that hard to learn,
you just need to learn either how to create objects and run a timer to see if a players position is near the object, or learn player pickup objects.
__________________
mansonh is offline  
Old 11/05/2010, 02:18 AM   #5
coole210
Gangsta
 
Join Date: Jul 2008
Location: Canada
Posts: 995
Reputation: 84
Default Re: {HELP} /dropgun command

You could use CreatePickup at the x,y,z or create a variable for the location
then when the person is close to the location a message will popup saying do you want this weapon with this ammo etc.
coole210 is offline  
Old 11/05/2010, 02:53 AM   #6
mansonh
Gangsta
 
Join Date: Jun 2009
Posts: 602
Reputation: 0
Default Re: {HELP} /dropgun command

Quote:
Originally Posted by [TPG
Coole210 ]
You could use CreatePickup at the x,y,z or create a variable for the location
then when the person is close to the location a message will popup saying do you want this weapon with this ammo etc.
Exactly . I think a pickup would be easiest.

@MG
I would love to script it for you but I don't have time, I have a large project I am working on atm.
Maybe in a few weeks when I am done my current project, or maybe when I get bored i will write you something. I think it could be done in about 100 lines.
But to be honest, if you do it yourself, your much better off.
__________________
mansonh is offline  
 

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] [FS] DropGun gimini Filterscripts 121 28/02/2018 12:47 AM
[Command Bugged] Each time i use /respawnallcars it says Unknown Command Rand_Omar Scripting Help 11 30/09/2012 12:35 AM
SERVER: Unknown Command when using a scripted command and it does execute! Moustafa Help Archive 6 11/06/2010 01:34 PM
/dropgun CMD - I need help mr.shark Help Archive 7 10/05/2010 09:13 PM
SERVER: Unknown Command - after login on every command virtualmarc Help Archive 0 20/09/2009 06:27 PM


All times are GMT. The time now is 10:45 AM.


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