Help regarding drop gun system -
ChristofferHoffmann - 20.07.2013
Howdy people
I have a question regarding this drop gun system. I have implemented it within my gamemode but sadly it doesn't work properly. Whenever I drop any of the guns within an interior (different virtualword, interior world - you name it) then it doesn't seem to recognize it. I can see the gun fall to the ground, but I'm not able to pick it up. It works fine in the normal world however. These are the two commands, and it's based upon a known filterscript found here:
https://sampforum.blast.hk/showthread.php?tid=217076
Hope you guys are able to help me out so it's able to detect whether or not I'm in the same interior/vw and therefore I would be able to pick up guns dropped in there.
Код:
command(dropgun, playerid, params[])
{
new string[128];
new Float:X,Float:Y,Float:Z;
new GunID = GetPlayerWeapon(playerid);
new GunAmmo = 60000;
GetPlayerPos(playerid, X, Y, Z);
RemovePlayerWeapon(playerid, GunID);
DropGun(playerid, GunID,GunAmmo,X,Y,Z,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
format(string, sizeof(string), "* %s drops their weaponry to the ground.", GetPlayerNameEx(playerid));
SendLocalMessage(playerid, string, 10.0, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
command(grab, playerid, params[])
{
new string[128];
for(new i = 0; i < sizeof(DropInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 2.0,DropInfo[i][DropGunPosX],DropInfo[i][DropGunPosY],DropInfo[i][DropGunPosZ]))
{
if(GetPlayerVirtualWorld(playerid) == DropInfo[i][DropGunVWorld] && GetPlayerInterior(playerid) == DropInfo[i][DropGunVWorld])
{
DestroyDynamicObject(DropObject[i]);
GivePlayerValidWeapon(playerid, DropInfo[i][DropGunAmmount][0], 60000);
DropInfo[i][DropGunPosX] = 0.0;
DropInfo[i][DropGunPosY] = 0.0;
DropInfo[i][DropGunPosZ] = 0.0;
DropInfo[i][DropGunAmmount][0] = 0;
DropInfo[i][DropGunAmmount][1] = 0;
format(string, sizeof(string), "* %s grabs a weapon from the ground.", GetPlayerNameEx(playerid));
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
SendLocalMessage(playerid, string, 10.0, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
}
}
return 1;
}
Re: Help regarding drop gun system -
verlaj - 20.07.2013
you should also try to add, if gun is dropped in any int or not for example, if get player location and int stuff(world stuff), if yes then if is player in that int and its virtual id. hope it will help you.
Re: Help regarding drop gun system -
RajatPawar - 20.07.2013
You can edit the DropGun function to add an interior parameter, and check for the interior within it, save it and all that.
Re: Help regarding drop gun system -
ChristofferHoffmann - 20.07.2013
I mean don't the following lines pretty much compare whether or not the VW/INT world is the same here?
At the drop part - get's the player interior/vw
Код:
DropGun(playerid, GunID,GunAmmo,X,Y,Z,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
On the grab function it compares to the dropped gun
Код:
if(GetPlayerVirtualWorld(playerid) == DropInfo[i][DropGunVWorld] && GetPlayerInterior(playerid) == DropInfo[i][DropGunVWorld])
Not quite sure how you want me to create it?
Re: Help regarding drop gun system -
ChristofferHoffmann - 21.07.2013
Anyone got an idea?
Re: Help regarding drop gun system -
ChristofferHoffmann - 26.07.2013
Bump