Jump to content

[HELP] PED DOESN'T CREATE


selam

Recommended Posts

Hello, I added a ped but it doesnt seems! Please help me out.

My meta.xml codes;

<info author="Admin" type="script" name="balik" description="balikcilik"/>
<script src="fish.Lua" type="server"/>

and Lua code;

 

function pedLoad ( name )
   createPed ( 36, 1623.5778808594, 576.61004638672, 1.7578125 )
end
addEventHandler ( "onResourceStart", getResourceRootElement(), pedLoad )

 

Link to comment
  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Just now, HassoN said:

Code seems fine. Try to use /debugscript 3 then restart the resource. Tell me if any error pops up.

I did write this but still same, cannot see the ped. By the way, to repeat, I selected "server" in meta.xml is this why?

Link to comment
34 minutes ago, HassoN said:

It is perfectly fine. The code is good, your meta is good as well. It must work, check if you are in dimension 0 and interior 0 at the correct place of the ped.

I solved the problem, it was because of meta.xml. But I have another question. How can I get ped stuck? When I hit him he is moving back

Link to comment
1 minute ago, HassoN said:

use setElementFrozen

I am trying to use this now but when I add that code, ped is getting lost.( ped script not working when I add elementfroozen)

@HassoN Ok now I fixed the getting lost problem, but now the problem is ped still going back when I hit him,

 

code;

 

function pedLoad(balikci)
    createPed ( 36, 1623.5778808594, 576.61004638672, 1.7578125 )
    setElementFrozen( "balikci", true )
end
addEventHandler("onResourceStart", getResourceRootElement(), pedLoad)

 

Link to comment

what's that ""balikci"" ? Use something like

function pedLoad(balikci)
   ped = createPed ( 36, 1623.5778808594, 576.61004638672, 1.7578125 )
    setElementFrozen( ped, true )
end
addEventHandler("onResourceStart", getResourceRootElement(), pedLoad)

 

Link to comment
Just now, HassoN said:

what's that ""balikci"" ? Use something like


function pedLoad(balikci)   ped = createPed ( 36, 1623.5778808594, 576.61004638672, 1.7578125 )    setElementFrozen( ped, true )endaddEventHandler("onResourceStart", getResourceRootElement(), pedLoad)

 

Balikci means fisher in turkish, I used "ped" now in both places, but doesnt work, ped is still getting back when I hit him

Link to comment
2 minutes ago, selam said:

Balikci means fisher in turkish, I used "ped" now in both places, but doesnt work, ped is still getting back when I hit him

It must work, the code is fine. Make sure that you've edited the correct file and refreshed/restarted the resource.

Edited by HassoN
Link to comment
Just now, HassoN said:

It must work, the code is fine. Make sure that you've edited the correct file and refreshed/restarted the resource.

function pedLoad(ped)
    ped = createPed ( 36, 1623.5778808594, 576.61004638672, 1.7578125 )
    setElementFrozen( "ped", true )
end
addEventHandler("onResourceStart", getResourceRootElement(), pedLoad)

Not working

Link to comment
Just now, selam said:

function pedLoad(ped)    ped = createPed ( 36, 1623.5778808594, 576.61004638672, 1.7578125 )    setElementFrozen( "ped", true )endaddEventHandler("onResourceStart", getResourceRootElement(), pedLoad)

Not working

Remove the string. it must be ped not "ped".

Link to comment
31 minutes ago, selam said:

@HassoN Ok I deleted " " thing from ped in 3.line, its working now thanks!

@HassoN Now I added SetElementHealth, and its working, but I want to make him immortal, how? Max hp is 100.

function cancelPedDamage() 
    cancelEvent() -- Cancels the onClientPedDamage event 
end 
addEventHandler("onClientPedDamage", getRootElement(), cancelPedDamage) 

 

Edited by MilWaxQ
Link to comment
28 minutes ago, MilWaxQ said:

function cancelPedDamage()     cancelEvent() -- Cancels the onClientPedDamage event end addEventHandler("onClientPedDamage", getRootElement(), cancelPedDamage) 

 

That will make all peds in the server immortal. You should use resourceRoot instead of getRootElement().

Link to comment
function PedLoad(ped)
	ped = createPed ( 36, 1623.5778808594, 576.61004638672, 1.7578125 )
	setElementFrozen( ped, true )
end
addEventHandler("onResourceStart", getResourceRootElement(), PedLoad)

and Meta;

 

<meta>
<script src="fish.Lua" type="client"/>
</meta>

 @HassoN @MilWaxQ I changed to client from server, and now the script is not working, I pasted the codes above.

Edited by selam
Link to comment
Just now, selam said:

function PedLoad(ped)	ped = createPed ( 36, 1623.5778808594, 576.61004638672, 1.7578125 )	setElementFrozen( ped, true )endaddEventHandler("onResourceStart", getResourceRootElement(), PedLoad)

and Meta;

 


<meta><script src="fish.Lua" type="client"/></meta>

 

function PedLoad(ped)
	ped = createPed ( 36, 1623.5778808594, 576.61004638672, 1.7578125 )
	setElementFrozen( ped, true )
	addEventHandler("onClientPedDamage", ped, cancelEvent)
end
addEventHandler("onClientResourceStart", resourceRoot, PedLoad)

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...