AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   DEATHS ZOMG (https://forums.alliedmods.net/showthread.php?t=93174)

--kml-- 05-25-2009 10:01

DEATHS ZOMG
 
DEATHS ZOMG


lol
in half life i cannot change the player's deaths o.o
are there anyway to change the player deaths?
set_user_deaths doesnt works


:crab::crab::crab:

Spunky 05-25-2009 10:15

Re: DEATHS ZOMG
 
set_user_deaths() is deprecated...

Bugsy 05-25-2009 10:19

Re: DEATHS ZOMG
 
For CS:
PHP Code:

#define OFFSET_CSDEATHS        444
#define fm_set_user_deaths(%1,%2) set_pdata_int(%1,OFFSET_CSDEATHS ,%2) 

You will then need to update scoreboard manually with this method:

PHP Code:

message_begin(MSG_ALL g_MsgScoreInfo );
write_byte(id);
write_short(iFrags);
write_short(iDeaths);
write_short(0);
write_short(iTeam);
message_end(); 


--kml-- 05-25-2009 10:22

Re: DEATHS ZOMG
 
how to use it?

PHP Code:

message_begin(MSG_ALL g_MsgScoreInfo );
write_byte(id);
write_short(iFrags);
write_short(iDeaths);
write_short(0);
write_short(iTeam);
message_end(); 

and also
@spunky
wat is deprecated LOL
im not good in english xD

:crab::crab::crab:


Bugsy 05-25-2009 10:32

Re: DEATHS ZOMG
 
If you want to combine it into one function, use the below. If you just want deaths, you can figure it out (I hope).

PHP Code:

SetScoreid 15 );
SetScoreid 10 ); 

PHP Code:

//Global
#define OFFSET_CSDEATHS        444

new g_MsgScoreInfo;

//plugin_init()
g_MsgScoreInfo get_user_msgid"ScoreInfo" );

public 
SetScoreid iFrags iDeaths 
{
    if( !
is_user_connectedid ) )
        return;
        
    
set_pevid pev_frags floatiFrags ) );
    
set_pdata_intid OFFSET_CSDEATHS iDeaths );

    
message_beginMSG_ALL g_MsgScoreInfo );
    
write_byteid );
    
write_shortiFrags );
    
write_shortiDeaths );
    
write_short);
    
write_shortget_user_teamid ) ) ;
    
message_end();



Arkshine 05-25-2009 10:35

Re: DEATHS ZOMG
 
Use the offset m_iDeaths ( 377 ) for HL.

Try this stock :

Code:
stock hl_set_user_deaths( const player, const deaths ) {     const m_iDeaths = 377;     static msgidScoreInfo;         if ( msgidScoreInfo || ( msgidScoreInfo = get_user_msgid( "ScoreInfo" ) ) )     {         set_pdata_int( player, m_iDeaths, deaths );                 message_begin( MSG_BROADCAST, msgidScoreInfo );         write_byte( player );         write_short( get_user_frags( player ) );         write_short( deaths );         write_short( 0 );         write_short( get_user_team( player ) );         message_end();     } }

--kml-- 05-29-2009 09:55

Re: DEATHS ZOMG
 
woooT
thx for helping
i will try 2 c if it works
P.S : why is it stock instead of public o.o
P.SS : YEs im a noob scripter

if only i can + karma
but still
i give you some crabs
:crab::crab::crab:

Bugsy 05-29-2009 10:05

Re: DEATHS ZOMG
 
From Pawn Language Guide (which I suggest you download)

Stock Functions
A “stock” function is a function that the pawn parser must “plug into” the program
when it is used, and that it may simply “remove” from the program (without warning)
when it is not used. Stock functions allow a compiler or interpreter to optimize the
memory footprint and the file size of a (compiled) pawn program: any stock function
that is not referred to, is completely skipped —as if it were lacking from the source
file. A typical use of stock functions, hence, is in the creation of a set of “library”
functions. A collection of general purpose functions, all marked as “stock”may be put
in a separate include file, which is then included in any pawn script. Only the library
functions that are actually used get “linked” in.

To declare a stock function, prefix the function name with the keyword stock. Public
functions and native functions cannot be declared "stock".

When a stock function calls other functions, it is usually a good practice to
declare those other functions as “stock” too —with the exception of native
functions. Similarly, any global variables that are used by a stock function
should in most cases also be defined “stock”. The removal of unused (stock)
functions can cause a chain reaction in which other functions and global
variables are not longer accessed either. Those functions are then removed
as well, thereby continuing the chain reaction until only the functions that
are used, directly or indirectly, remain.

Stock Variables
A global variable may be declared as “stock”. A stock declaration is one that the parser
may remove or ignore if the variable turns out not to be used in the program.

--kml-- 05-29-2009 20:42

Re: DEATHS ZOMG
 
oo
so it is removed when we compile or when we use it ?

and where is the guide xD
i want to download it

Bugsy 05-29-2009 21:51

Re: DEATHS ZOMG
 
A stock is only compiled into your plugin (.amxx) if the function\variable is used. For example, suppose you have 3 stocks in your plugin\include file: get_name(), get_id(), get_health() and in your plugin you only call get_id() out of those 3 (get_name() and get_health() are never used). get_id() is the only function that will be compiled into your amxx file. This will, as said above, improve the memory footprint and reduce the file size of your compiled .amxx file.

The guide:

http://www.compuphase.com/pawn/Pawn_Language_Guide.pdf

Other useful links:

http://www.compuphase.com/pawn/pawn.htm#DOWNLOAD_DOCS


All times are GMT -4. The time now is 01:36.

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