Ped on terrain

Well, I think the title does not explain it well …

I spent the whole day looking for a native to detect if the ped is on land

but I want to differentiate between land and pavement or a street

It occurred to me to use different natives, but even then I would not get the difference between land and cement.

Solution:

Edit: it is worth clarifying that it is necessary to use the manifest of the corresponding version of the natives.

I have these and the natives worked well
resource_manifest_version ‘05cfa83c-a124-4cfa-a768-c24a5811d8f9’

1 Like

Right now I will try to find the hash of the material that is the ped

Does anyone have any ideas?

Are you looking to see if a player is on any actual “road” vs any other “ground surface” or does it really have to be “pavement/cement vs dirt, no matter if there’s a real road there”?

1 Like

differentiate the different surfaces … more than anything I want to get the land (the dirt floor so say) … well I think

I also need to differentiate if there is a path

and excuse my English
thx for help

Why exactly do you need this? I don’t think you can detect the type of ground, but you can check if they are on a street/road

I’m doing a planting system and the idea is to plant when you want, but of course I can not plant in cement / pavement … But I will not have anything else that can be planted anywhere and that people use it responsibly … …

Although it is good to differentiate if it is a street / road, do you know if there is a native?

Maybe @Deltanic knows how to check for different ground types when placing objects?

Edit: @Deltanic has no clue on how to achieve this either, besides checking if you’re on a road. (Using natives to check for a road that you’re currently on)

Okay, thank you very much for the help …

He was already thinking about the sounds emitted or something like that. But, it remains that the sea has been used with good use

You can close the topic

You can use a raycast/capsule thingy, and one of the thing it returns is the hash of the terrain type

Got a code snippet for that? Or just guessing that it’ll work? Sounds like it could work though

function GetGroundHash(veh)
	local coords = GetEntityCoords(veh)
	local num = StartShapeTestCapsule(coords.x,coords.y,coords.z+4,coords.x,coords.y,coords.z-2.0, 1,1,veh,7)
	local arg1, arg2, arg3, arg4, arg5 = GetShapeTestResultEx(num)
	return arg5
end

Credit to @Blumlaut for the code, had it for a while in my little box of treats

6 Likes

It sounds interesting … when I get home I’ll try it

You are my hero, it works wonders

now it’s time to take the hash and this will be alive soon and many people will enjoy it: D

I leave the function, I just made the modification to work with a ped …

function GetGroundHash(ped)
        local posped = GetEntityCoords(ped)
        local num = StartShapeTestCapsule(posped.x,posped.y,posped.z+4,posped.x,posped.y,posped.z-2.0, 2, 1, ped, 7)
        local arg1, arg2, arg3, arg4, arg5 = GetShapeTestResultEx(num)
end

Edit: it is worth clarifying that it is necessary to use the manifest of the corresponding version of the natives.

I have these and the natives worked well
resource_manifest_version ‘05cfa83c-a124-4cfa-a768-c24a5811d8f9’

thank you very much really

3 Likes

No problem, happy to help :stuck_out_tongue:

Hello I was wondering if you had this surface hash tool from the top left of your screen available.

hello how to have this script?

2 Likes