Lol, tell me why
I'm not a C++ god and my code is very far from beeing perfect.
Code:
// ***************************************************************
// Copyright (C) 2006/2007 Bloodline except otherwise marked.
// All Rights reserved.
// -------------------------------------------------------------
// file: Net.Server.Events | date: 10/4/2007
// -------------------------------------------------------------
// purpose:
// ***************************************************************
// [10/4/2007 Bloodline] - Created
long Net_SvEventFunctions[255];
DLLFUNC void Net_SvEventFunctionsReset()
{
for(int i=0;i<254;i++)
Net_SvEventFunctions[i]=NULL;
}
DLLFUNC void Net_SvEventSetFunction(int ID, STRING* Name)
{
long Func = engine_getscript( Name->chars );
if(Func!=NULL)
{
if(ID<0 || ID>=255) Net_Error_Raise("Net: Net_SvEventSetFunction - ID is not valid!");
Net_SvEventFunctions[ID] = Func;
}
else
Net_Error_Raise("Net: Net_SvEventSetFunction - Function not found!");
}
void Net_SvEventExecuteFunction(int ID, long Arg1, long Arg2, long Arg3, long Arg4)
{
if(ID<0 || ID>=255) Net_Error_Raise("Net: Net_SvEventExecuteFunction - ID is not valid!");
if(Net_SvEventFunctions[ID]!=NULL)
{
engine_callscript( Net_SvEventFunctions[ID], Arg1, Arg2, Arg3, Arg4 );
}
}