Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » C++ help question
Re: C++ help question [message #381736 is a reply to message #380533] Tue, 21 April 2009 14:03 Go to previous messageGo to previous message
Xpert is currently offline  Xpert
Messages: 1588
Registered: December 2005
Location: New York City
Karma:
General (1 Star)
Okay, I'm completely stomped. I tried so many things and still end up back to square one. This time I went to debug the scripts.dll. It points to 2 parts of the code and it makes no sense to me.


GMMAIN.CPP

struct VeteranPlayers {
        std::string PlayerName;
        int VeteranPoints;
};
 
std::vector<VeteranPlayers> VetInfo;
 
 
int VetCheckPoints(int ID) {
        if (!VetInfo.empty()) {
                for (int i = 0; i < VetInfo.size(); i++) {
                        HERE --> if (VetInfo[i].PlayerName == Get_Player_Name_By_ID(ID)) {
                                int Points;
                                Points = VetInfo[i].VeteranPoints;
                                return Points;
                        }
                }
        }
        return 0;
}



GMMAIN.H

int VetCheckPoints(int ID);



GMSCRIPTS.CPP

void MDB_SSGM_Vehicle::Custom(GameObject *obj, int message, int param, GameObject *sender) {
        HERE -->int Points = VetCheckPoints(Get_Player_ID(sender));
        float health = Commands->Get_Max_Health(obj);
        float armor = Commands->Get_Shield_Strength(obj);
 
        if (message == CUSTOM_EVENT_VEHICLE_ENTER) {
                if (Settings->EnableVehOwn && Get_Vehicle_Owner(obj) == sender && !Find_My_Veh(sender)) {
                        Commands->Attach_Script(obj,"MDB_SSGM_Vehicle_Owner",StrFormat("%d,%d",Commands->Get_ID(sender),Get_Object_Type(sender)).c_str());
                        Console_Input(StrFormat("ppage %d Your vehicle has been auto-bound to you. Use !unbind to relinquish ownership. Use !lock to prevent your teammates from stealing the vehicle.",Get_Player_ID(sender)).c_str());
                        if (Points >= 120) {
                                Set_Max_Health(obj, health*1.40f);
                                Set_Max_Shield_Strength(obj, armor*1.40f);
                                Commands->Set_Health(obj, Commands->Get_Max_Health(obj));
                                Commands->Set_Shield_Strength(obj, Commands->Get_Max_Shield_Strength(obj));
                                Attach_Script_Once(obj,"cAMpa_Regen","3,1,8");
                        }
                        else if (Points >= 90 && Points < 120) {
                                Set_Max_Health(obj, health*1.30f);
                                Set_Max_Shield_Strength(obj, armor*1.30f);
                                Commands->Set_Health(obj, Commands->Get_Max_Health(obj));
                                Commands->Set_Shield_Strength(obj, Commands->Get_Max_Shield_Strength(obj));
                                Attach_Script_Once(obj,"cAMpa_Regen","4,1,6");
                        }
                        else if (Points >= 60 && Points < 90) {
                                Set_Max_Health(obj, health*1.20f);
                                Set_Max_Shield_Strength(obj, armor*1.20f);
                                Commands->Set_Health(obj, Commands->Get_Max_Health(obj));
                                Commands->Set_Shield_Strength(obj, Commands->Get_Max_Shield_Strength(obj));
                                Attach_Script_Once(obj,"cAMpa_Regen","4,1,4");
                        }
                        else if (Points >= 30 && Points < 60) {
                                Set_Max_Health(obj, health*1.10f);
                                Set_Max_Shield_Strength(obj, armor*1.10f);
                                Commands->Set_Health(obj, Commands->Get_Max_Health(obj));
                                Commands->Set_Shield_Strength(obj, Commands->Get_Max_Shield_Strength(obj));
                                Attach_Script_Once(obj,"cAMpa_Regen","4,1,2");
                        }
                }
        }
}



When I debugged it, it pointed to the parts I put "HERE -->" above, as being the problem.

I don't know what to do. This is frustrating me >.>



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

[Updated on: Tue, 21 April 2009 14:05]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Skin Request]
Next Topic: RenX ERROR
Goto Forum:
  


Current Time: Sat Dec 21 10:42:17 MST 2024

Total time taken to generate the page: 0.00969 seconds