{HELP} /dropgun command
#1

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;
}
Reply
#2

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
Reply
#3

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
Reply
#4

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.
Reply
#5

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.
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)