20.07.2013, 00:48
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.
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; }