It'd have to use the eval() function to create a new function within a function, it'd work but the code will be very messy, plus you'd have to use a backwards slash when you use strings.
eg;
eval("function ServerCmdEventCmd(%cl,%msg,%msg1,%msg2){ echo(\"done deh stuff\"); }");