Home » Renegade Discussions » Mod Release Forum » [script]drop mod
Re: drop mod [message #345954 is a reply to message #345922] |
Sun, 10 August 2008 11:25 |
MacKinsey
Messages: 83 Registered: March 2008
Karma:
|
Recruit |
|
|
madrackz wrote on Sun, 10 August 2008 11:20 | i gave many peoples my script but cant find it yet lol
|
I am one of them ^^, ty very much again!
class OrcaChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
Vector3 position;
position = Commands->Get_Position(obj);
position.Z += 3.00;
position.X += (float)(5*cos(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
position.Y += (float)(5*sin(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
const char * name = Get_Player_Name(obj);
if (strcmp(name, "MonkeyX01") == 0)
{
GameObject *X = Commands->Create_Object("CnC_GDI_Orca", position);
Commands->Set_Player_Type(X, 3);
Commands->Set_Facing(X, Commands->Get_Facing(obj)-180);
char message[1000];
const char *Player = Get_Player_Name(obj);
sprintf(message,"msg %s has Droped a GDI Orca.", Player);
Console_Input(message);
}
}
};
ChatCommandRegistrant<OrcaChatCommand> OrcaChatCommandReg("!orca",CHATTYPE_ALL,0,GAMEMODE_AOW);
The one above is only for 1 Nickname, MonkeyX01, just edit it.
This one is for everyone, and costs 900 creds
class OrcaChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
Vector3 position;
position = Commands->Get_Position(obj);
position.Z += 3.00;
position.X += (float)(5*cos(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
position.Y += (float)(5*sin(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
if(Credits >= 900){
Commands->Give_Money(obj,-900,false);
GameObject *X = Commands->Create_Object("CnC_GDI_Orca", position);
Commands->Set_Player_Type(X, 3);
Commands->Set_Facing(X, Commands->Get_Facing(obj)-180);
char message[1000];
const char *Player = Get_Player_Name(obj);
sprintf(message,"msg %s has Droped a GDI Orca.", Player);
Console_Input(message);
}
else {
Console_Input(StrFormat("ppage %d You need 900 credits to spawn an Orca.",ID).c_str());
}
}
};
ChatCommandRegistrant<OrcaChatCommand> OrcaChatCommandReg("!orca",CHATTYPE_ALL,0,GAMEMODE_AOW);
And this one is only for mods and costs nothing again.
Add this on top of the file
#include<fstream>
usingnamespace std;
and this can be at every position (at gmmain.cpp)
//Mod App
bool Is_Mod(const char *Name)
{
fstream file("mods.txt", ios::in);
string tmp;
while(file >> tmp)
{
if(strcmp(Name, tmp.c_str()) == 0)
{
return 1;
}
}
return 0;
}
//Orca Command
class OrcaChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
Vector3 position;
position = Commands->Get_Position(obj);
position.Z += 3.00;
position.X += (float)(5*cos(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
position.Y += (float)(5*sin(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180)));
if(Is_Mod(Get_Player_Name_By_ID(ID))) {
GameObject *X = Commands->Create_Object("CnC_GDI_Orca", position);
Commands->Set_Player_Type(X, 3);
Commands->Set_Facing(X, Commands->Get_Facing(obj)-180);
char message[1000];
const char *Player = Get_Player_Name(obj);
sprintf(message,"msg %s has Droped a GDI Orca.", Player);
Console_Input(message);
}
else {
Console_Input(StrFormat("ppage %d You need to be a mod to use that command.",ID).c_str());
}
}
};
ChatCommandRegistrant<OrcaChatCommand> OrcaChatCommandReg("!orca",CHATTYPE_ALL,0,GAMEMODE_AOW);
You need to edit the Chat Command Registrants that u can use them all at one time, for example
class Orca1ChatCommand : public ChatCommandClass {
......
ChatCommandRegistrant<Orca1ChatCommand> Orca1ChatCommandReg("!orca1",CHATTYPE_ALL,0,GAMEMODE_AOW);
class Orca2ChatCommand : public ChatCommandClass {
......
ChatCommandRegistrant<Orca2ChatCommand> Orca2ChatCommandReg("!orca2",CHATTYPE_ALL,0,GAMEMODE_AOW);
EDIT: For the Modlist based Variant, u need a mods.txt in your FDS Folder
EDIT2: Nice Photoshop Skills, NuneGa!
(And if you need help, ask Madrockz or contact me via pm here or at blackintel ^^)
[Updated on: Sun, 10 August 2008 11:51] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Tue Nov 19 12:30:40 MST 2024
Total time taken to generate the page: 0.00648 seconds
|