AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Add shootable model (https://forums.alliedmods.net/showthread.php?t=104478)

Metabolic 09-23-2009 22:29

Add shootable model
 
hi everybody,

i just started to wirte my first plugin so i have some basic questions i think :).
I didn't find anything in the tutorials so i have to ask you guys...

The problem is:

I want to add at a random point in the map a model which can be shot by the players. The model should only be visible for some seconds and it would be great if it could move too.

I already found some code to add a model to the map but how do i move the model or give it a hitbox so the players can shoot at it?

I hope somebody could give me a hint...

thx for the help in advance,
Metabolic

NatalyaAF 09-24-2009 17:37

Re: Add shootable model
 
You'd need a model that was compiled so it can be runs as prop_dynamic or prop_physics because they would probably already have default hitboxes.

olj 09-24-2009 18:49

Re: Add shootable model
 
TeleportEntity should help with moving.

Metabolic 09-29-2009 18:46

Re: Add shootable model
 
hi,

sry for my late reply...
Thank you very much that realy helped me.

But is there an event fired when the model is hit?
I didn't find one...

Because i want that the player can shoot at the model and then they get something for hitting it.

olj 10-02-2009 08:40

Re: Add shootable model
 
Well, browse events. http://wiki.alliedmods.net/Game_Events_(Source)

As a workaround you can hook IN_ATTACK, and then use GetClientAimTarget to check if client is looking at a model and if he do, that means he is shooting at that model (you can check what weapons he using also, and if it is melee one - check distance before doing something).

EDIT: Here it is, player_shoot event exists http://wiki.alliedmods.net/Generic_S...s#player_shoot


All times are GMT -4. The time now is 00:09.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.