selam Posted July 22, 2019 Share Posted July 22, 2019 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
HassoN Posted July 22, 2019 Share Posted July 22, 2019 Code seems fine. Try to use /debugscript 3 then restart the resource. Tell me if any error pops up. Link to comment
selam Posted July 22, 2019 Author Share Posted July 22, 2019 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
HassoN Posted July 22, 2019 Share Posted July 22, 2019 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. Link to comment
selam Posted July 22, 2019 Author Share Posted July 22, 2019 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
HassoN Posted July 22, 2019 Share Posted July 22, 2019 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 Link to comment
selam Posted July 22, 2019 Author Share Posted July 22, 2019 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
HassoN Posted July 22, 2019 Share Posted July 22, 2019 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
selam Posted July 22, 2019 Author Share Posted July 22, 2019 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
HassoN Posted July 22, 2019 Share Posted July 22, 2019 (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 July 22, 2019 by HassoN Link to comment
selam Posted July 22, 2019 Author Share Posted July 22, 2019 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
HassoN Posted July 22, 2019 Share Posted July 22, 2019 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
selam Posted July 22, 2019 Author Share Posted July 22, 2019 @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. Link to comment
MilWaxQ Posted July 22, 2019 Share Posted July 22, 2019 (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 July 22, 2019 by MilWaxQ Link to comment
selam Posted July 22, 2019 Author Share Posted July 22, 2019 @MilWaxQ You added "OnClientPedDamage" but my all codes on server side not client. Link to comment
MilWaxQ Posted July 22, 2019 Share Posted July 22, 2019 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. Link to comment
selam Posted July 22, 2019 Author Share Posted July 22, 2019 @MilWaxQ Then I have to change it from meta.xml too right? Link to comment
MilWaxQ Posted July 22, 2019 Share Posted July 22, 2019 1 minute ago, selam said: @MilWaxQ Then I have to change it from meta.xml too right? Yes Link to comment
selam Posted July 22, 2019 Author Share Posted July 22, 2019 2 minutes ago, MilWaxQ said: Yes Now the script is not working? Link to comment
MilWaxQ Posted July 22, 2019 Share Posted July 22, 2019 Just now, selam said: Now the script is not working? Paste your full script and meta.xml Link to comment
HassoN Posted July 22, 2019 Share Posted July 22, 2019 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
selam Posted July 22, 2019 Author Share Posted July 22, 2019 (edited) 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 July 22, 2019 by selam Link to comment
HassoN Posted July 22, 2019 Share Posted July 22, 2019 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
MilWaxQ Posted July 22, 2019 Share Posted July 22, 2019 (edited) 2 minutes ago, selam said: function PedLoad(ped) ped = createPed ( 36, 1623.5778808594, 576.61004638672, 1.7578125 ) setElementFrozen( ped, true ) end addEventHandler("onResourceStart", getResourceRootElement(), PedLoad) Use onClientResourceStart and resourceRoot Edited July 22, 2019 by MilWaxQ Link to comment
selam Posted July 22, 2019 Author Share Posted July 22, 2019 @HassoN Thanks, so as I see I have to use client to make my peds immortal right? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now