Raised This Month: $51 Target: $400
 12% 

how to get and remove frags with ham


Post New Thread Reply   
 
Thread Tools Display Modes
Rivotril
Senior Member
Join Date: Feb 2014
Location: Argentina
Old 01-12-2017 , 00:31   Re: how to get and remove frags with ham
Reply With Quote #11

---------------------------
Fatal Error
---------------------------
User Msg 'ScoreInfo': 7 bytes written, expected 9

---------------------------
OK
---------------------------
Rivotril is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 01-12-2017 , 01:29   Re: how to get and remove frags with ham
Reply With Quote #12

Ham_AddPoints.

Code:
    /**      * Description:  Typically adds points to the entity.      *        This function is not supported by Team Fortress Classic mod.      * Forward params:  function(this, points, bool:cangonegative);      * Return type:  None.      * Execute params:  ExecuteHam(Ham_AddPoints, this, points, bool:cangonegative);      */
PartialCloning is offline
Rivotril
Senior Member
Join Date: Feb 2014
Location: Argentina
Old 01-12-2017 , 01:46   Re: how to get and remove frags with ham
Reply With Quote #13

Quote:
Originally Posted by PartialCloning View Post
Ham_AddPoints.

Code:
    /**      * Description:  Typically adds points to the entity.      *        This function is not supported by Team Fortress Classic mod.      * Forward params:  function(this, points, bool:cangonegative);      * Return type:  None.      * Execute params:  ExecuteHam(Ham_AddPoints, this, points, bool:cangonegative);      */
Thankssssss
Rivotril is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 01-12-2017 , 07:27   Re: how to get and remove frags with ham
Reply With Quote #14

Just to clarify the regular usage

PHP Code:
new gmsgScoreInfo;

public 
plugin_init()
{
    
gmsgScoreInfo get_user_msgid("ScoreInfo");
}

stock set_score(id,frags,deaths)
{
    new 
CsTeams:iTeam cs_get_user_team(id);

    
set_user_frags(id,frags);
    
cs_set_user_deaths(id,deaths);
    
message_begin(MSG_ALL,gmsgScoreInfo);
    
write_byte(id);
    
write_short(frags);
    
write_short(deaths);
    
write_short(0);
    
write_short(_:iTeam);
    
message_end();

Basically, when you set the frags and deaths, you update the values the server is storing. You don't update the scoreboard however. So if you remove the message part of this code, you will still update the score, but it will only start showing once the scoreboard is refreshed again (player makes a kill or dies). As an example, if you add 5 frags nothing will show on score, then as soon as player kills someone he will get 6 frags.

Now the message part does the updating manually. However if you only do that then the game's values don't get updated and as soon as the player kills or dies he will go back to the old score.

If you need to add or subtract from the existing score, use the get_user_frags() and get_user_deaths() functions.
PHP Code:
...
set_score(id,get_user_frags(id)+1,get_user_deaths(id)-1//add 1 frag and remove 1 death 
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
Reply



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


All times are GMT -4. The time now is 06:48.


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