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

[HELP] Money from 2'nd round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
faKe91
Member
Join Date: Jan 2012
Location: Moldova, Chisinau
Old 02-17-2015 , 16:13   [HELP] Money from 2'nd round
Reply With Quote #1

Hello!. A have a system that integrates forum and server. So my idea is to give some bonus if the players are active on forum. I made an plugin that gives money from second round, but sometime it gets errors like this:

[AMXX] Displaying debug trace (plugin "forum_bonus.amxx")
[AMXX] Run time error 4: index out of bounds
[AMXX] [0] forum_bonus.sma::Event_RoundStart (line 39)

And there was some strange, that if I'm on the server, I take the money. But if I leave the server, another player takes the money from my name.

Here is the code:

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <colorchat>
  
#pragma semicolon 1
  
forward xen_core(idMemberID, const Name[], PostsLikes, const Status[], LastVisit);
  
enum xen_profile {
   
activity_visible,
   
user_id,
   
username[64],
   
message_count,
   
like_count,
   
custom_title[64],
   
last_activity
};
  
new 
xen_data[24][xen_profile], iMoneymaxplayers;
new 
Round 0;
  
public 
plugin_init() {
   
register_plugin("Forum Bonus""0.1""faKe");
   
register_event("TextMsg""Event_TextMsg""a""2=#Game_Commencing");
   
register_event("HLTV""Event_RoundStart""a""1=0""2=0");
   
register_logevent("LogEvent_Restart_Round"2"1&Restart_Round_");
   
maxplayers get_maxplayers();
}
 
public 
Event_TextMsg()
    
Round 0;
  
public 
LogEvent_Restart_Round()
    
Round 0;
  
public 
Event_RoundStart()
{
    
Round++;
    if (
Round 1)
    for (new 
id=1;id<=maxplayers;id++)
    if(
is_user_connected(id) && is_user_alive(id))
    {
        if(
xen_data[id][activity_visible])
        
set_task(0.5,"give_bonus",id );
        else
        
client_print_color(id0"^4[Forum Bonus] ^3Want ^4Bonus? ^3Register on our forum!");
    }
    return 
PLUGIN_CONTINUE;
}

public 
give_bonus(id)

    
iMoney 150;
    
iMoney += xen_data[id][like_count]*2;
    
iMoney += xen_data[id][message_count]*2;
    if(
xen_data[id][last_activity] + 86400 get_systime())
    
iMoney += 150;
    
cs_set_user_money(idmin(cs_get_user_money(id) + iMoney16000));
    
client_print_color(id0"^4[Forum Bonus] ^3Hello ^4%s! ^3You got ^4%d$ ^3for your activity on forum!"xen_data[id][username], iMoney);
}
  
public 
xen_core(idMemberID, const Name[], PostsLikes, const Status[], LastVisit)
{
    if(
is_user_connected(id) && MemberID != 0)
    {
        
xen_data[id][activity_visible] = true;
        
xen_data[id][user_id] = MemberID;
        
xen_data[id][message_count] = Posts;
        
xen_data[id][like_count] = Likes;
        
copy(xen_data[id][custom_title], 63Status);
        
xen_data[id][last_activity] = LastVisit;
        
copy(xen_data[id][username], 63Name);
    }

If someone could help me, I will be very glad. Thanks!

Last edited by faKe91; 02-17-2015 at 17:11.
faKe91 is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 02-18-2015 , 10:37   Re: [HELP] Money from 2'nd round
Reply With Quote #2

For the index out of bounds:
PHP Code:
xen_data[24][xen_profile

PHP Code:
xen_data[33][xen_profile
__________________
Currently offline for study.
RateX is offline
faKe91
Member
Join Date: Jan 2012
Location: Moldova, Chisinau
Old 02-18-2015 , 12:16   Re: [HELP] Money from 2'nd round
Reply With Quote #3

Thanks, I will try!
faKe91 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 01:44.


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