Jump to content

Peds attack you, and got a chainsaw...


tinnetju

Recommended Posts

Hello, I wanted to make a little Myth script with a man thats in a train tunnel with MANY many health and a chainsaw. I already got the .txt file and the replace file and that working.

The spawn .lua is server sided, but the setpedstat and give weapon stuff is client sided, how do i connect them?

And i also can't find how to make him attack you with the chainsaw running (you know, when the chainsaw says HIIIIIIIIIIIIIINNNNGGGG)

Here is the client side:

txd = engineLoadTXD("126.txd") 
engineImportTXD(txd, 126) 
  
function pedLoad ( pedLoad ) 
   setPedStat( ped,24,2000) 
   setPedStat( ped,164,2000) 
   giveWeapon ( source, 2, 1 ) 
   setPedWeaponSlot ( ped, 1 ) 
end 
addEventHandler ( "onResourceStart", getRootElement(), pedLoad ) 

And here is the server side:

createPed ( 126, 871.64227294922, 2720.6179199219, 20.586917877197 ) 

I debugged it and it says no errors or something,

Link to comment
I already got the .txt file and the replace file and that working.

What do you mean by that?

You can't have giveWeapon client-side, since it's a server-side only function.

To move the ped and have him attack, you need setPedControlState.

But let me tell you that this is quite a complicated thing to do.

You need a client to calcute the ped's movement (like turning into the victims direction and of course running) and the attacking and then sync it to the server.

So, you actually have to write a mini AI, which isn't an easy task even for quite good programmers, let alone beginners.

And there is also math involved, so you should know your sinus and cosinus. ;)

Link to comment
I already got the .txt file and the replace file and that working.

What do you mean by that?

You can't have giveWeapon client-side, since it's a server-side only function.

To move the ped and have him attack, you need setPedControlState.

But let me tell you that this is quite a complicated thing to do.

You need a client to calcute the ped's movement (like turning into the victims direction and of course running) and the attacking and then sync it to the server.

So, you actually have to write a mini AI, which isn't an easy task even for quite good programmers, let alone beginners.

And there is also math involved, so you should know your sinus and cosinus. ;)

oowwh soz i ment .txd and to bad its that hard :l

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