Quote:
Originally Posted by
tedaimlocks
solved. for anyone who needs the plugin :
wtf
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <zp_buymenu>
#define PLUGIN "Money convert"
#define VERSION "1.0"
#define AUTHOR "tedaimlocks"
public plugin_init () {
register_plugin ( PLUGIN , VERSION , AUTHOR )
set_task ( 10.0 , "loop_client_putinserver" , 0 , "" , 0 , "b" );
}
public loop_client_putinserver ()
{
new id ;
for( id = 1 ; id <= get_maxplayers (); id ++)
{
if( is_user_connected ( id ))
{
client_putinserver ( id );
}
}
return PLUGIN_HANDLED ;
}
public client_putinserver ( id ) {
if (! is_user_connected ( id ) || is_user_bot ( id ))
return PLUGIN_CONTINUE ;
cs_set_user_money ( id , zp_cs_get_user_money ( id ));
return PLUGIN_HANDLED ;
}
hi, I guess you're you are trying to restore the money to the player "only" when he connects to the server, this would be done once therefore it is
not necessary to create an infinite loop since it
recreates an overload to the server and more if it is a zp
for them we can make sure that the player has entered and chosen a team, and then give them the money.
It will be enough, try...
Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <zp_buymenu>
#if AMXX_VERSION_NUM > 182
#define client_disconnect client_disconnected
#else
#define MAX_PLAYERS 32
#endif
new bool : is_spawn[ MAX_PLAYERS + 1 ]
public plugin_precache( )
{
RegisterHam( Ham_Spawn, "player" , "Ham_SpawnPlayer_Post" , true )
}
public Ham_SpawnPlayer_Post( id)
{
if ( ! is_spawn[ id] && is_user_alive ( id) )
{
is_spawn[ id] = true
cs_set_user_money( id, zp_cs_get_user_money( id) )
}
}
public client_putinserver( id)
{
if ( is_user_bot ( id) )
{
is_spawn[ id] = true
}
}
public client_disconnect( id)
{
if ( is_spawn[ id] )
{
is_spawn[ id] = false
}
}
__________________