.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Metamod: setting player health
Old
  (#1)
InternetNightmare
Guest
 
Status:
Posts: n/a
Default Metamod: setting player health - 12-02-2004

Hello!
Well I'm coding a MetaMOD plugin and hmmm... I don't know how to set health or armor... Well it's easy to do it with AMX, but I want my MOD to be "AMX-free" Help!



InternetNightmare
(someone who wants to know everythings in the world! Really!)
  
Reply With Quote
Re: Metamod: setting player health
Old
  (#2)
InternetNightmare
Guest
 
Status:
Posts: n/a
Default Re: Metamod: setting player health - 12-02-2004

Oh! Its pent->v.health==200;
  
Reply With Quote
Re: Metamod: setting player health
Old
  (#3)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default Re: Metamod: setting player health - 13-02-2004

1) make sure you also set max_health or it may ignore your changes.

2) Be sure to do this inSpawm_post.
If you try it in Spawn() your changes will be overwritten.
Here is a little code that maxes out the health of the hostages.


int Spawn_post(edict_t *pent)
{
// are we spawning a hostage ?
if (strcmp (STRING (pent->v.classname), "hostage_entity") == 0)
{
// Max out the health of the hostages
pent->v.max_health = 0x0FFFFFFF;
pent->v.health = 0x0FFFFFFF;
}
RETURN_META_VALUE (MRES_IGNORED, 0);
}
  
Reply With Quote
Re: Metamod: setting player health
Old
  (#4)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Metamod: setting player health - 13-02-2004

As Austin says, unless setting the health or armor at spawn time, the problem with forcing a player's health or armor server-side without notifying the client of the changes is that the client's data will be wrong compared to the server's. This can lead to bizarre behaviour, such as the client believing the player is dead, and starting playing the death animation, then receiving an update from the server telling it that this player is still moving and shooting stuff. You will then see a wandering corpse farting bullets.

When you set the health or armor of a client arbitrarily, don't forget to send him a "Health" or "Armor" network message. The shape of such messages is generally standard between all MODs.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Metamod: setting player health
Old
  (#5)
InternetNightmare
Guest
 
Status:
Posts: n/a
Default Re: Metamod: setting player health - 13-02-2004

I will have to read about messages... If you know some good links, feel free to tell...
  
Reply With Quote
Re: Metamod: setting player health
Old
  (#6)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Metamod: setting player health - 13-02-2004

The functions in the game DLL to engine interface that are used for sending network messages are:

pfnMessageBegin()
pfnWriteByte()
pfnWriteString()
pfnWriteAnythingTheCrapElseOrWhateverAndTheLikes()
pfnMessageEnd()

Every message must begin with a call to pfnMessageBegin() - or the MESSAGE_BEGIN macro - and end with a call to MESSAGE_END. These functions tell the engine to build a header and a footer for the message before and after sending bytes on the wire. Then, according to the syntax of the message, you either send a byte, a string, a float, whatever, provided it's shaped like a genuine game message so that the client, at the other end of the wire, will understand it. To learn about the syntax of the different network messages, look for examples of them through the SDK.


BTW. I believe there's a typo in your signature



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Metamod: setting player health
Old
  (#7)
InternetNightmare
Guest
 
Status:
Posts: n/a
Default Re: Metamod: setting player health - 13-02-2004

Pierre-Marie Baty thanks!
Oh yes there is! Thanks! And now I have to get the list of messages...
  
Reply With Quote
Re: Metamod: setting player health
Old
  (#8)
Onno Kreuzinger
aka: memed / Server Admin
 
Onno Kreuzinger's Avatar
 
Status: Offline
Posts: 705
Join Date: Jan 2004
Location: germany
Default Re: Metamod: setting player health - 13-02-2004

oh i though he came from barain (ouch that would have had an extra h in)
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com