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

Cstrike Module to Fakemeta [+Ham]


Post New Thread Reply   
 
Thread Tools Display Modes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-17-2009 , 13:13   Re: Cstrike Module to Fakemeta [+Ham]
Reply With Quote #21

Umm... how would a fakemeta version of a cstrike module work in another mod?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 03-17-2009 , 14:33   Re: Cstrike Module to Fakemeta [+Ham]
Reply With Quote #22

One thing you can do using fakemeta'ed natives is include support for mod specific functions without tying the plugin to a game. For instance, you can check what game is running and choose beetween cs_set_user_money or ts_set_user_money, or just disable the feature. If you include one of the modules, the plugin simply wouldn't load at other games.

Here is an example: If I used the cstrike module instead of fakemeta, this command wouldn't work on other mods:

Code:
stock fm_cs_set_user_armor(id, iValue, iType = CS_ARMOR_VESTHELM)
{
    set_pev(id, pev_armorvalue, float(iValue))
    
    // Counter-Strike
    static bCStrike
    if(!bCStrike)
        bCStrike = GetGameRunning(GAME_CSTRIKE) ? 1 : -1
    
    if(bCStrike == 1)
    {
        set_pdata_int(id, OFFSET_ARMORTYPE, iType)
        
        static msgArmorType
        if(!msgArmorType)
            msgArmorType = get_user_msgid("ArmorType")
        
        if(msgArmorType)
        {
            message_begin(MSG_ONE, msgArmorType, _, id)
            write_byte(iType == CS_ARMOR_VESTHELM ? 1 : 0)
            message_end()
        }
    }
    
    return true
}

public Armor_Command(id,level,cid)
{
    if(!cmd_access(id,level,cid,3) || !_CmdTarget(1, id, (CMDTARGET_OBEY_IMMUNITY|CMDTARGET_ALLOW_SELF|CMDTARGET_ONLY_ALIVE)))
        return PLUGIN_HANDLED

    new iArmorType = CS_ARMOR_KEVLAR
    if(UTIL_ReadArgBool(3, id) == 1)
        iArmorType = CS_ARMOR_VESTHELM
    
    new iArmor = 0
    if(!UTIL_ReadArgInt(2, iArmor, CHECK_NONZERO))
        console_print(id, "%L", "ARG_NUM_INVALID", 2)
    else
    {
        new iPlayer, iTempArmor
        
        for(new i=0; i < g_iPlayersNum; i++)
        {
            iPlayer = g_iPlayers[i]
            
            iTempArmor = max(get_user_armor(iPlayer) + iArmor, 0)
            fm_cs_set_user_armor(iPlayer, iTempArmor, iArmorType)
        }
        
        UTIL_PrintActivity(id, (iArmor > 0) ? "ARMOR_GIVE" : "ARMOR_TAKE", g_szTarget, abs(iArmor))
    }
    
    return PLUGIN_HANDLED
}
__________________

Community / No support through PM

Last edited by danielkza; 03-17-2009 at 14:39.
danielkza is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-17-2009 , 14:38   Re: Cstrike Module to Fakemeta [+Ham]
Reply With Quote #23

Quote:
Originally Posted by danielkza View Post
One thing you can do using fakemeta'ed natives is include support for mod specific functions without tying the plugin to a game. For instance, you can check what game is running and choose beetween cs_set_user_money or ts_set_user_money, or just disable the feature. If you include one of the modules, the plugin simply wouldn't load at other games.
That's what these:
Code:
	set_native_filter( "native_trapper" );
	set_module_filter( "module_filter" );
are for
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 03-17-2009 , 18:38   Re: Cstrike Module to Fakemeta [+Ham]
Reply With Quote #24

Quote:
Originally Posted by stupok View Post
So The Specialists has the same offset for money as Counter-Strike?

It (probably) doesn't, and that's what vittu is getting at. Each mod has its own offsets and little intricacies. Using fakemeta isn't making anything more compatible.

I suppose you could argue that with fakemeta, you would only have to change a few #defines that declare the offsets, where if you use cs_get_user_money, you would have to do a "replace all" with ts_getusercash. Further, maybe some mods don't have a function, so you would need to use fakemeta.

That's a negligible benefit, in my opinion.

I think a trend is exactly what it is.
You are right. I didn't played nor programmed for another mod so, i don't know what i'm talking about.The Cstrike module had gained a negative connotation but, using it, for the majority of the cases, its a better solution than fakemeta. (It does the same as a fakemeta equivalent, but in C++, so there isn't the expense of calling natives from Pawn)
__________________

Last edited by joaquimandrade; 03-17-2009 at 18:41.
joaquimandrade is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 03-18-2009 , 10:35   Re: Cstrike Module to Fakemeta [+Ham]
Reply With Quote #25

Quote:
Originally Posted by vittu View Post
Some people just got on some crazy fakemeta high and thought everything needed to be converted to it to use less modules because they were told doing so was optimizing. Not specifically talking about this thread or anyone who has posted in this thread.
Completely agreed. I went on a rant like this a while ago. Using FakeMeta in place of cstrike is a terrible idea. If the offsets ever change, the AMXX team will jump right on it and release a new cstrike module right away. This would require anyone using this header to update it themselves or hope that you're still around to do it. There are many, many other problems but most have already been covered in this thread.

EDIT: Here it is:
http://forums.alliedmods.net/showthread.php?p=734716

It's not directly related to the cstrike module, but many of the concepts still apply.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 03-18-2009 , 11:26   Re: Cstrike Module to Fakemeta [+Ham]
Reply With Quote #26

Profile results
Attached Files
File Type: txt profileData.txt (2.2 KB, 305 views)
File Type: sma Get Plugin or Get Source (csfm.sma - 919 views - 2.4 KB)
__________________
joaquimandrade is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-18-2009 , 11:49   Re: Cstrike Module to Fakemeta [+Ham]
Reply With Quote #27

Thanks for the bench joaquimandrade! I'm not surprised by the result at all.
Arkshine is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 03-18-2009 , 12:11   Re: Cstrike Module to Fakemeta [+Ham]
Reply With Quote #28

Not surprising at all. Even if it was faster, the other consequences of using this would outweigh the benefits.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 03-26-2009 , 13:25   Re: Cstrike Module to Fakemeta [+Ham]
Reply With Quote #29

Error: Undefined symbol "m_iWeaponFiremode"
Empowers is offline
Send a message via ICQ to Empowers
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-26-2009 , 16:09   Re: Cstrike Module to Fakemeta [+Ham]
Reply With Quote #30

Sorry about that. It is fixed now.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 03:23.


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