AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fix plugin. (https://forums.alliedmods.net/showthread.php?t=170653)

Lolz0r 10-27-2011 12:39

Fix plugin.
 
Hi all, this plugin takes the money and gievs them on the next round but it doesn`t work correctly can someone fix it?

PHP Code:

#include <amxmodx>
#include <cstrike>

new iGetUserMoney[33], iRound;

public 
plugin_init()
{
    
register_plugin("Round Money Remove""1.0""kostov");
    
    
register_event("TextMsg""eGetMoney""a""2&#Game_w");
    
register_logevent("iNewRound"2"1=Round_Start");
    
register_logevent("iEndRound"2"1=Round_End");
}

public 
eGetMoney()
{
    new 
iPlayers[32], iNumiPlayer;
    
get_players(iPlayersiNum"ch");
    
    if(
iNum <= 1)
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if(
iRound == 1)
    {
        return 
PLUGIN_CONTINUE;
    }
    
    for(new 
0iNumi++) 
    {
        
iPlayer iPlayers[i];
        
        
iGetUserMoney[iPlayer] == cs_get_user_money(iPlayer);
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
iEndRound()
{
    ++
iRound;
}

public 
iNewRound()
{
    new 
iPlayers[32], iNumiPlayer;
    
get_players(iPlayersiNum"ch");
    
    if(
iNum <= 1)
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if(
iRound == 1)
    {
        return 
PLUGIN_CONTINUE;
    }
    
    for(new 
0iNumi++) 
    {
        
iPlayer iPlayers[i];
        
        
cs_set_user_money(iPlayeriGetUserMoney[iPlayer]);
    }
    
    return 
PLUGIN_CONTINUE;



kramesa 10-27-2011 13:10

Re: Fix plugin.
 
What the function of this plugin?

Lolz0r 10-27-2011 13:21

Re: Fix plugin.
 
So basically this plugin takes all of your money in the end of the round and retruns them in the beginning of the next, but unfortunately it doesn't work. Could you fix it?

kramesa 10-27-2011 13:32

Re: Fix plugin.
 
Plugin works perfectly. You have cstrike dll?

Lolz0r 10-27-2011 13:50

Re: Fix plugin.
 
I'm using this plugin:

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define VERSION    "1.0"

new g_iHostageZone;

public 
plugin_init(){ 
    
register_plugin("Hostage Entity"VERSION"kostov");
    
register_cvar("hostage_zone_version"VERSIONFCVAR_SERVER|FCVAR_SPONLY);
    
set_cvar_string("hostage_zone_version",    VERSION);
}

public 
plugin_precache(){
    
register_forward(FM_Spawn"HostageSpawn"0);
    new 
CreateHostageEnt engfunc(EngFunc_AllocString"hostage_entity");
    do{
        
g_iHostageZone engfunc(EngFunc_CreateNamedEntityCreateHostageEnt);}
    while(!
pev_valid(g_iHostageZone));
    
engfunc(EngFunc_SetSizeg_iHostageZoneFloat:{-1.0, -1.0, -1.0}, Float:{1.01.01.0});
    
engfunc(EngFunc_SetOriging_iHostageZoneFloat:{0.00.0, -55000.0});
    
dllfunc(DLLFunc_Spawng_iHostageZone);
    return 
PLUGIN_CONTINUE;
}

public 
HostageSpawn(id){
    if(!
pev_valid(id) || id == g_iHostageZone){
        return 
FMRES_IGNORED;}
    new 
g_sClass[32];
    
pev(idpev_classnameg_sClass31);
    return 
FMRES_IGNORED;


It restarts the round on maps wit no active entity by creating an invisible zone with hostages, everything works alright but when the round gets restarted both team's players are with 0$, so that I need a plugin that takes off all the money of each player in the end of the round and returns them in the beginning of the next.

joshknifer 10-27-2011 14:39

Re: Fix plugin.
 
Try changing the order of the plugins in your config file. Put the one with the money transfer first.

Lolz0r 10-27-2011 15:52

Re: Fix plugin.
 
No change. The same problem.

kramesa 10-27-2011 17:35

Re: Fix plugin.
 
Check your modules.ini (cstrike module)

Try it:

PHP Code:

#include <amxmodx> 
#include <cstrike> 

new iGetUserMoney[33], iRound

public 
plugin_init() 

    
register_plugin("Round Money Remove""1.0""kostov"); 
     
    
register_event("TextMsg""eGetMoney""a""2&#Game_w"); 
    
register_logevent("iNewRound"2"1=Round_Start"); 
    
register_logevent("iEndRound"2"1=Round_End"); 


public 
eGetMoney() 

    new 
iPlayers[32], iNumiPlayer
    
get_players(iPlayersiNum"ch"); 
     
    if(
iNum <= 1
    { 
        return 
PLUGIN_CONTINUE
    } 
     
    if(
iRound == 1
    { 
        return 
PLUGIN_CONTINUE
    } 
     
    for(new 
0iNumi++)  
    { 
        
iPlayer iPlayers[i]; 
         
        
iGetUserMoney[iPlayer] == cs_get_user_money(iPlayer); 
    } 
     
    return 
PLUGIN_CONTINUE


public 
iEndRound() 

    ++
iRound


public 
iNewRound() 

    new 
iPlayers[32], iNumiPlayer
    
get_players(iPlayersiNum"ch"); 
     
    if(
iNum <= 1
    { 
        return 
PLUGIN_CONTINUE
    } 
     
    if(
iRound == 1
    { 
        return 
PLUGIN_CONTINUE
    } 
     
    for(new 
0iNumi++)  
    { 
        
iPlayer iPlayers[i]; 
         
        
cs_set_user_money(iPlayeriGetUserMoney[iPlayer]); 
    } 
     
    return 
PLUGIN_CONTINUE


Works perfectly.

joshknifer 10-27-2011 18:30

Re: Fix plugin.
 
Here is another possible solution:
https://forums.alliedmods.net/showthread.php?t=126821

Lolz0r 10-28-2011 16:07

Re: Fix plugin.
 
@kramesa, the same thing again.

@joshknifer, I got the following errors with that plugin:


Code:

L 10/28/2011 - 23:04:34: [CSTRIKE] Invalid player 1
L 10/28/2011 - 23:04:34: [AMXX] Displaying debug trace (plugin "axa1.amxx")
L 10/28/2011 - 23:04:34: [AMXX] Run time error 10: native error (native "cs_set_user_money")
L 10/28/2011 - 23:04:34: [AMXX]    [0] axa1.sma::HamSpawnPost (line 43)



All times are GMT -4. The time now is 14:20.

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