View Single Post
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 01-29-2018 , 01:09   Re: VScript Functions
Reply With Quote #7

Quote:
Originally Posted by Vit_amin View Post
Wow! Nice !
What about Left 4 Dead 2 VScripts ?
You can call vscript functions in l4d2 with this stock.
however it should work in just about anygame.

Found in timocop's plugin director unlocker
https://forums.alliedmods.net/showthread.php?p=2535972

PHP Code:
/**
* Runs a single line of vscript code.
* NOTE: Dont use the "script" console command, it startes a new instance and leaks memory. Use this instead!
*
* @param sCode        The code to run.
* @noreturn
*/
stock L4D2_RunScript(const String:sCode[], any:...)
{
    static 
iScriptLogic INVALID_ENT_REFERENCE;
    if(
iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic)) {
        
iScriptLogic EntIndexToEntRef(CreateEntityByName("logic_script"));
        if(
iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic))
            
SetFailState("Could not create 'logic_script'");
        
        
DispatchSpawn(iScriptLogic);
    }
    
    static 
String:sBuffer[512];
    
VFormat(sBuffersizeof(sBuffer), sCode2);
    
    
SetVariantString(sBuffer);
    
AcceptEntityInput(iScriptLogic"RunScriptCode");

__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline