Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Help with an array.
Help with an array. [message #390692] Mon, 15 June 2009 09:32 Go to previous message
Xpert is currently offline  Xpert
Messages: 1588
Registered: December 2005
Location: New York City
Karma:
General (1 Star)
Okay, so basically, I'm trying to get an array going to count the players that damage a certain vehicle(s). I was getting help from someone with this and so far no luck. Maybe someone can find what we're doing wrong?


int damageObject[127];
void reb_vehicle::Created(GameObject *obj) {
        vehstartmaxhealth = Commands->Get_Max_Health(obj);
        vehstartmaxarmor = Commands->Get_Max_Shield_Strength(obj);
        Commands->Start_Timer(obj, this, 1.5f, 1);
        this->isUpgraded = false;
        for (int i=0; i < 128; i++)
        {
                damageObject[i] = 0;
        }
}
 
void reb_vehicle::Damaged(GameObject *obj, GameObject *damager, float damage) {
        if (damage < 0) {           
                if (Commands->Is_A_Star(damager) && Commands->Get_Player_Type(damager) == Commands->Get_Player_Type(obj)) {
                        RepUpdate(Get_Player_ID(damager), (int)((damage - damage) - damage)/2);
                }
        }
		int objId = Get_Player_ID(damager);
        damageObject[objId] = objId;
}
 
void reb_vehicle::Killed(GameObject *obj, GameObject *shooter) {
        if (Commands->Is_A_Star(shooter) && Commands->Get_Player_Type(shooter) != Commands->Get_Player_Type(obj)) {
                for (int i=0; i < 1;i++)
                {
                        GameObject *mainobj = Get_GameObj(damageObject[i]);
                        VetUpdate(damageObject[i], (int)GetPoints(Commands->Get_Preset_Name(obj)), (int)Commands->Get_Points(mainobj));
                        Display_Int_Player(mainobj,GetPoints(Commands->Get_Preset_Name(obj)),"Veteran points gained: %d  "),GetPoints(Commands->Get_Preset_Name(obj));
                }
        }
}


It crashes when the damaged vehicle gets killed/destroyed.

And the structure for VetUpdate is
VetUpdate(int ID, int number, int score)



http://i32.photobucket.com/albums/d42/XpertMaverick/xpertyankee.jpg

Creator of NetGuard, an IRC network regulator.
Developer of the CloudyServ 0.982-X project.
Developer of the CloudyServ Ren-X bot.

Part time streamer - https://twitch.tv/gg_wonder
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: First Map in 3D Studio Max
Next Topic: How would i go about making a hud.ini
Goto Forum:
  


Current Time: Sun Dec 22 08:05:47 MST 2024

Total time taken to generate the page: 0.00704 seconds