Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Having problems with C++
Having problems with C++ [message #335728] Tue, 17 June 2008 19:10 Go to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
I'm having problems with this code.
I want to make a command that arests a player and teleports it into a zone.
Zone id = 100054

Here is the code:
class jailChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
if (!Text[1].empty() ) {
int player = atoi(Text[1].c_str());
GameObject *obj = Get_GameObj(player);
	int x = ?????????("100054");
GameObject *gotoObject = Commands->Find_Object(x);
		 Vector3 gotoLocation = Commands->Get_Position(gotoObject);
 		Commands->Set_Position(obj,gotoLocation);
}
else {
Console_Input(StrFormat("ppage %d ERROR!",ID).c_str());
}
}
};
ChatCommandRegistrant<jailChatCommand> jailChatCommandReg("!jail",CHATTYPE_ALL,1,GAMEMODE_AOW);



I dont know what to put in the place where are the ???????.
Do any of you guys know what i could put there?
I got it from a script and it was Get_Int_Parameter but it is getting a error:
Quote:

1>.\gmmain.cpp(3116) : error C3861: 'Get_Int_Parameter': identifier not found


This account is no longer being active.
Re: Having problems with C++ [message #335729 is a reply to message #335728] Tue, 17 June 2008 19:22 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
class jailChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
if (!Text[1].empty() ) {
int player = atoi(Text[1].c_str());
GameObject *obj = Get_GameObj(player);
	int x = 100054;
GameObject *gotoObject = Commands->Find_Object(x);
		 Vector3 gotoLocation = Commands->Get_Position(gotoObject);
 		Commands->Set_Position(obj,gotoLocation);
}
else {
Console_Input(StrFormat("ppage %d ERROR!",ID).c_str());
}
}
};
ChatCommandRegistrant<jailChatCommand> jailChatCommandReg("!jail",CHATTYPE_ALL,1,GAMEMODE_AOW);
Re: Having problems with C++ [message #335731 is a reply to message #335729] Tue, 17 June 2008 19:31 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Works perfect, thanks.
Do you know a !sell all code?
I cant seem to figure out how to make it. I made one but when i die, i cant sell my objects any more.


This account is no longer being active.
Re: Having problems with C++ [message #335771 is a reply to message #335731] Wed, 18 June 2008 03:28 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
HeavyX101 wrote on Tue, 17 June 2008 21:31

Works perfect, thanks.
Do you know a !sell all code?
I cant seem to figure out how to make it. I made one but when i die, i cant sell my objects any more.

Do it with INI´s, then "save" the ID of the Object.
Re: Having problems with C++ [message #335814 is a reply to message #335771] Wed, 18 June 2008 09:31 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
madrackz wrote on Wed, 18 June 2008 06:28

HeavyX101 wrote on Tue, 17 June 2008 21:31

Works perfect, thanks.
Do you know a !sell all code?
I cant seem to figure out how to make it. I made one but when i die, i cant sell my objects any more.

Do it with INI´s, then "save" the ID of the Object.

Well, i cant do that cuz i dont know how to save the files. Well, i might learn it. Thanks for helping guys Smile


This account is no longer being active.
Re: Having problems with C++ [message #335831 is a reply to message #335814] Wed, 18 June 2008 12:17 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Sorry for double post.
But i need your help guys.
class jailChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
if (!Text[1].empty() ) {
      const char *pris = Get_Player_Name(Get_Part_Name(Text[1].c_str()));
	  int player = atoi(pris); 
GameObject *obj = Get_GameObj(player);
	int x = 100054;
GameObject *gotoObject = Commands->Find_Object(x);
		 Vector3 gotoLocation = Commands->Get_Position(gotoObject);
 		Commands->Set_Position(obj,gotoLocation);
			Change_Character(obj,"GDI_Prisoner_v0a");
             Commands->Set_Shield_Type(obj,"Blamo");
			       Console_Input(StrFormat("cmsg 166,149,56 [BSS: %d Has Been Arrested ]", Get_Player_ID(Get_Part_Name(Text[1].c_str()))).c_str());

}
else {
Console_Input(StrFormat("ppage %d ERROR!",ID).c_str());
}
}
};
ChatCommandRegistrant<jailChatCommand> jailChatCommandReg("!jail;!j",CHATTYPE_ALL,1,GAMEMODE_AOW);


It compiled fine. But ingame, when i write !jail HeavyX101 , it says the message "[BSS: -1 Has Been Arrested ]" but it is not putting me into the jail. Why is that?


This account is no longer being active.
Re: Having problems with C++ [message #335837 is a reply to message #335728] Wed, 18 June 2008 13:09 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
int player = atoi(pris);

because of that.
Re: Having problems with C++ [message #335840 is a reply to message #335837] Wed, 18 June 2008 13:25 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Ok, this is what i did now:
class jailChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
if (!Text[1].empty() ) {
      const char *pris = Get_Player_Name(Get_Part_Name(Text[1].c_str())); 
GameObject *obj = Get_GameObj(pris);
	int x = 100054;
GameObject *gotoObject = Commands->Find_Object(x);
		 Vector3 gotoLocation = Commands->Get_Position(gotoObject);
 		Commands->Set_Position(obj,gotoLocation);
			Change_Character(obj,"GDI_Prisoner_v0a");
             Commands->Set_Shield_Type(obj,"Blamo");
			       Console_Input(StrFormat("cmsg 166,149,56 [BSS: %d Has Been Arrested ]", Get_Player_ID(Get_Part_Name(Text[1].c_str()))).c_str());

}
else {
Console_Input(StrFormat("ppage %d ERROR!",ID).c_str());
}
}
};
ChatCommandRegistrant<jailChatCommand> jailChatCommandReg("!jail;!j",CHATTYPE_ALL,1,GAMEMODE_AOW);


I get this error:
Quote:

Error 1 error C2664: 'Get_GameObj' : cannot convert parameter 1 from 'const char *' to 'int' c:\Westwood\RenegadeFDS\Server\gmmain.cpp 3222


This account is no longer being active.
Re: Having problems with C++ [message #335849 is a reply to message #335728] Wed, 18 June 2008 14:12 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
Get_GameObj needs a player ID.

class jailChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
if (!Text[1].empty() ) {
      const char *pris = Get_Player_Name(Get_Part_Name(Text[1].c_str())); 
GameObject *obj = Get_GameObj_By_Player_Name(pris);
	int x = 100054;
GameObject *gotoObject = Commands->Find_Object(x);
		 Vector3 gotoLocation = Commands->Get_Position(gotoObject);
 		Commands->Set_Position(obj,gotoLocation);
			Change_Character(obj,"GDI_Prisoner_v0a");
             Commands->Set_Shield_Type(obj,"Blamo");
			       Console_Input(StrFormat("cmsg 166,149,56 [BSS: %d Has Been Arrested ]", Get_Player_ID(Get_Part_Name(Text[1].c_str()))).c_str());

}
else {
Console_Input(StrFormat("ppage %d ERROR!",ID).c_str());
}
}
};
ChatCommandRegistrant<jailChatCommand> jailChatCommandReg("!jail;!j",CHATTYPE_ALL,1,GAMEMODE_AOW);
Re: Having problems with C++ [message #335853 is a reply to message #335849] Wed, 18 June 2008 14:52 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Compiled but it still doesnt teleport me to the jail.
I think it is this line:
Quote:

const char *pris = Get_Player_Name(Get_Part_Name(Text[1].c_str()));


This account is no longer being active.
Re: Having problems with C++ [message #336068 is a reply to message #335728] Thu, 19 June 2008 19:23 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
worked fine for me are all the errors in const char *pris = Get_Player_Name(Get_Part_Name(Text[1].c_str()));

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Having problems with C++ [message #336071 is a reply to message #336068] Thu, 19 June 2008 19:41 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
It compiles fine but when i type !jail heavyx101 , it does not put me in jail, it just says [BSS: -1 Has been arrested]

This account is no longer being active.
Re: Having problems with C++ [message #336119 is a reply to message #335728] Fri, 20 June 2008 03:50 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
Console_Input(StrFormat("cmsg 166,149,56 [BSS: %d Has Been Arrested ]", Get_Player_ID(obj)).c_str());


Re: Having problems with C++ [message #336175 is a reply to message #336119] Fri, 20 June 2008 10:11 Go to previous message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Still says [BSS: -1 Has been arrested] and it does not put me in jail.

This account is no longer being active.
Previous Topic: could anyone help me with this mod commands
Next Topic: [Release] split mine limit plug-in
Goto Forum:
  


Current Time: Tue Nov 26 03:12:05 MST 2024

Total time taken to generate the page: 0.00841 seconds