16
Bully Modding / Re: Game Documentation: Save Data in Lua
« on: August 01, 2022, 12:37:33 AM »cool,love you man.
Etherous (my char) is going to be a lord now lmao.
News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..
Messages | Topics | Attachments
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
cool,love you man.
Whenever I use a condition like PedMePlaying(array[integer], "Default_KEY", true), it will only detect the last stored ped.
if PedIsValid(TABLE[1]) and PedMePlaying(TABLE[1], 'DEFAULT_KEY') then
-- do something to the first ped.
end
if PedIsValid(TABLE[3]) and PedMePlaying(TABLE[3], 'DEFAULT_KEY') then
-- do something to the third ped.
end
How do I get the value of the previous ones?
if PedIsValid(TABLE[table.getn(TABLE) - 1]) and PedMePlaying(TABLE[table.getn(TABLE) - 1], 'DEFAULT_KEY') then
-- do something to the previous ped from the last.
end
for ID, PED in ipairs(TABLE) do
if PedIsValid(PED) and PedMePlaying(PED, 'DEFAULT_KEY') then
-- do something to all registered pedestrians in the table.
end
end
Or Object ID not work in CreatePersistentEntity
if IsButtonBeingPressed(3, 0) then
local X, Y, Z = PlayerGetPosXYZ()
local OBJ = {ObjectFindInArea(X, Y, Z, 2)}
-- check if there's any object around us
if OBJ[1] then
for ID = 2, table.getn(OBJ) do
ObjectBreak(OBJ[ID])
end
local COUNT = table.getn(OBJ) - 1
TextPrintString(COUNT..' object'..(COUNT > 1 and 's' or '')..' removed!', 3, 1)
else
TextPrintString('There is no object around!', 3, 1)
end
end
Just really handy to watch things on the page you're viewing rather than it opening in a new tab :')