コード例 #1
0
qboolean Scr_PlayerSay(gentity_t* from, int mode, const char* text){

    int callback;
    int threadId;

    callback = script_CallBacks_new[SCR_CB_NEW_SAY];
    if(!callback){
        return qfalse;
    }
    if(!say_forwardAll)
    {
        if(*text != '/' && *text != '.' && *text != '&')
            return qfalse;

        Scr_AddString(&text[1]);

    }else{
        Scr_AddString(text);
    }
    if(mode == 0)
        Scr_AddBool( qfalse );
    else
        Scr_AddBool( qtrue );

    threadId = Scr_ExecEntThread(from, callback, 1);

    Scr_FreeThread(threadId);

    return qtrue;

}
コード例 #2
0
qboolean Scr_ScriptCommand(int clientnum, const char* cmd, const char* args){

    int callback;
    int threadId;

    int i, j;

    char textbuf[MAX_STRING_CHARS];
    /* Clean control characters */
    for(i = 0, j = 0; i < sizeof(textbuf) -1 && args[i]; ++i)
    {
        textbuf[j] = args[i];

        if(textbuf[j] < ' ')
        {
            continue;
        }
        ++j;
    }
    textbuf[j] = '\0';

    callback = script_CallBacks_new[SCR_CB_SCRIPTCOMMAND];
    if(!callback){
        Scr_Error("Attempt to call a script added function without a registered callback: maps/mp/gametypes/_callbacksetup::CodeCallback_ScriptCommand\nMaybe you have not used addscriptcommand() like it is supposed to use?");
        return qfalse;
    }

    Scr_AddString(textbuf);

    Scr_AddString(cmd);

    if(clientnum < 0 || clientnum > 63)
    {
        threadId = Scr_ExecThread(callback, 2);
    }else{
        threadId = Scr_ExecEntThread(&g_entities[clientnum], callback, 2);
    }

    Scr_FreeThread(threadId);

    return qtrue;
}
コード例 #3
0
ファイル: entity.cpp プロジェクト: therifboy/echelon-bo2
void execEntThread(gentity_s* ent, int32_t handle, uint32_t paramCount)
{
	uint16_t tid = Scr_ExecEntThread(ent, handle, paramCount);
	Scr_FreeThread(SCRIPTINSTANCE_SERVER, tid);
}