Jump to content

[HELP] PED DOESN'T CREATE


selam

Recommended Posts

Posted

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 )

 

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Posted
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?

Posted

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.

Posted
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

Posted
13 minutes ago, selam said:

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

use setElementFrozen

Posted
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)

 

Posted

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)

 

Posted
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

Posted (edited)
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
Posted
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

Posted
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".

Posted

@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.

Posted (edited)
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
Posted
Just now, selam said:

@MilWaxQ You added "OnClientPedDamage" but my all codes on server side not client.

There is no ped damage event for server side. Create a client script and add this to it.

Posted
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().

Posted
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)

 

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...