Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » !spec script release  () 5 Votes
Re: !spec script release [message #330126 is a reply to message #329028] Sun, 11 May 2008 15:01 Go to previous messageGo to previous message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma:
Colonel
renalpha wrote on Mon, 05 May 2008 05:15

Usage,

Uses a mods.txt file for the people who are allowed to spec,
this also can be hard coded but i dont know how to do that
since im not awesome o coder.

I think the following installation is fine though i didnt used the code anymore so idk.

i tested it and it was working without crashes bugs etc.

gmscripts.cpp : source file
void Player_Spectate::Created(GameObject *obj) {
Commands->Set_Is_Visible(obj,false);
Commands->Set_Model(obj,"null");
Commands->Set_Shield_Type(obj,"Blamo");
Commands->Clear_Weapons(obj);
Toggle_Fly_Mode(obj);
Commands->Disable_All_Collisions(obj);
}
class spectateChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
if(Is_Mod(Get_Player_Name_By_ID(ID))) {
if (Is_Script_Attached(obj,"Player_Spectate")) {
Commands->Destroy_Object(obj);
}
else {
Commands->Attach_Script(obj,"Player_Spectate","");
}
}
}
};
ChatCommandRegistrant<spectateChatCommand> spectateChatCommandReg("!spec",CHATTYPE_ALL,0,GAMEMODE_AOW);
ScriptRegistrant<Player_Spectate> Player_Spectate_Registrant("Player_Spectate","");


gmmain.cpp
/* Renegade Scripts.dll
SSGM main functions and classes
Copyright 2007 Vloktboky, Whitedragon(MDB), Mac, Jonathan Wilson
This file is part of the Renegade scripts.dll
The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version. See the file COPYING for more details.
In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
Only the source code to the module(s) containing the licenced code has to be released.
*/
#include<fstream>
usingnamespace std;
#include<stdarg.h>
#include"scripts.h"
#include"date.h"
#include"engine.h"
#include"gmmain.h"
#ifdef WIN32
#include<ddeml.h>
#else
#include <dlfcn.h>
#endif
 
bool OkLoad = false;
#ifndef WIN32
extern void *bhs;
UnloaderClass Unloader;
#endif
DataStruct *Data = 0;
SettingsStruct *Settings = 0;
bool Is_Mod(constchar *Name)
{
fstream file("mods.txt", ios::in);
string tmp;
while(file >> tmp)
{ 
if(strcmp(Name, tmp.c_str()) == 0)
{
return 1;
}
}
return 0;
}



Header script
class Player_Spectate : public ScriptImpClass {
public:
void Created(GameObject *obj);
};


Umm, sorry for asking this, but how do you make this work?


This account is no longer being active.
 
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
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
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: C++. Need help.
Next Topic: Scripts
Goto Forum:
  


Current Time: Sun Nov 10 23:40:00 MST 2024

Total time taken to generate the page: 0.01065 seconds