Help with object not deleteing
#1

Right okay i have this dgun and pgun system but when you do /pgun it does not remove the gun from the floor it picks it up just does not remove the object model any ideas.




some code

Код:
CMD:pgun(playerid, params[])
{
	if(PlayerInfo[playerid][pConnectTime] < 6) return SendClientMessage(playerid, COLOR_GREY, "You must have at least 6 play hours, /stats to check it.");
	if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
	new f = MAX_OBJ+1;
	new GunID = GetPlayerWeapon(playerid);
	for(new a = 0; a < MAX_OBJ; a++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 5.0, dGunData[a][ObjPos][0], dGunData[a][ObjPos][1], dGunData[a][ObjPos][2]))
		{
			f = a;
			break;
		}
	}
	if(f > MAX_OBJ) return SendClientMessage(playerid, COLOR_GREY, "You are not near the weapon which you can pick up.");
	dGunData[f][ObjID] = DestroyObject(GunObjects[GunID]);
	GivePlayerValidWeapon(playerid, dGunData[f][ObjData][0], dGunData[f][ObjData][1]);
	dGunData[f][ObjPos][0] = 0.0;
	dGunData[f][ObjPos][1] = 0.0;
	dGunData[f][ObjPos][2] = 0.0;
	dGunData[f][ObjID] = -1;
	dGunData[f][ObjData][0] = 0;
	dGunData[f][ObjData][1] = 0;
	new string[128];
	format(string, sizeof(string), "* %s took a gun from the ground", RPN(playerid), GunNames[dGunData[f][ObjData][0]]);
	if(PlayerInfo[playerid][pMask] == 1)
	{
 		format(string, sizeof(string), "* Stranger took a gun from the ground", GunNames[dGunData[f][ObjData][0]]);
	}
	else
	{
		format(string, sizeof(string), "* %s took a gun from the ground", RPN(playerid), GunNames[dGunData[f][ObjData][0]]);
	}
	SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)