AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   Action Script for XP Block (https://forums.alliedmods.net/showthread.php?t=110946)

NiQu 12-05-2009 01:20

Action Script for XP Block
 
This is the action needed to make an xp block into blockmaker to work with exolents hns xp mod :)

PHP Code:

action_XPBLOCK(idOverrideTimerent)
{
    new 
Float:fTime halflife_time();
    if (
fTime >= gfXPNextUse[id] || OverrideTimer)
    {
        if(
cs_get_user_team(id) == CS_TEAM_T)
        {
            new 
szProperty1[33];
            
Get_BlockProperty(ent1szProperty1);
            
            
hnsxp_add_user_xpidstr_to_num(szProperty1) );
            
gfXPNextUse[id] = fTime 170;
            
set_hudmessage(gHudRedgHudGreengHudBluegfTextXgfTextYgHudEffectsgfHudFxTimegfHudHoldTimegfHudFadeInTimegfHudFadeOutTimegHudChannel);
            
show_hudmessage(id"YOU GOT A FEW MORE XP!");
        }
    }


Also, to use this you need to use his API thing, im using this on my server so dont say this dont work.

Tested On: FSCM ( Flaxans Course Maker )(a remake of bunnyhop course maker and blockmaker ).

Oh, and another thing.. if u look into this code you can see "( id, str_to_num(szProperty1) );" wich means you need a blockmaker that has "Set Properties" item in the menu.

For an example: i belive BCM5 has it :)

Exolent[jNr] 12-05-2009 01:40

Re: Action Script for XP Block
 
As of a new update, hnsxp_add_user_xp() was removed since it was obvious how to work it.
You need to do one of these:
Code:
#define hnsxp_add_user_xp(%1,%2) hnsxp_set_user_xp(%1, hnsxp_get_user_xp(%1) + %2)
or
Code:
// change hnsxp_add_user_xp(id, xp) // to hnsxp_set_user_xp(id, hnsxp_get_user_xp(id) + xp)

NiQu 12-05-2009 01:57

Re: Action Script for XP Block
 
Yeh okay thanks for that, however i wont bother changing to the new one anyway :)

mannyeon 02-07-2010 06:21

Re: Action Script for XP Block
 
when i compile i .sma, one errors occures:
"hnsxp_set_user_xp"
it says like its has no meaning and like the command doesnt exist... what should i do?

NiQu 02-08-2010 19:14

Re: Action Script for XP Block
 
Mannyeon, use exolents API and it shud work.

lazarev 02-09-2010 07:02

Re: Action Script for XP Block
 
fail action code :)

NiQu 02-10-2010 02:10

Re: Action Script for XP Block
 
lazarev its not fail, it works 100%.. just outdated.

lazarev 02-10-2010 11:54

Re: Action Script for XP Block
 
I use this one ^__^
PHP Code:

actionXP(idOverrideTimer)
{
    
//get game time
    
new Float:fTime halflife_time();
    
    if (
fTime >= gfXPNextUse[id] || OverrideTimer)
    {
        if ( 
cs_get_user_team id ) == CS_TEAM_T )
        {
            new 
xp_give get_pcvar_num(bm_xp_givexp)
            
hnsxp_add_user_xp(idxp_give);
            new 
szName33 ];
            
get_user_nameidszName32 );
            
ColorChat(0GREEN"%s^x03 [ %s ]^x01 is now got^x03 [%d]^x01 XP!"gszPrefixszNamexp_give);
            
gfXPNextUse[id] = fTime get_cvar_float("bm_xpcooldown");
        }
    }
    else
    {
        
set_hudmessage(gHudRedgHudGreengHudBluegfTextXgfTextYgHudEffectsgfHudFxTimegfHudHoldTimegfHudFadeInTimegfHudFadeOutTimegHudChannel);
        if( 
get_cvar_float("bm_xpcooldown") >= 600.0 
            
show_hudmessage(id"XP next use: new round"gfXPNextUse[id] - fTime);
            
        else     
show_hudmessage(id"XP next use: %.1f"gfXPNextUse[id] - fTime);
    }



NiQu 02-11-2010 13:59

Re: Action Script for XP Block
 
that probably works too.. but mine doesnt work for all blockmakers.. so who cares, i dont mind if someoen removed this thread.

mannyeon 02-13-2010 09:55

Re: Action Script for XP Block
 
API?


All times are GMT -4. The time now is 02:41.

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