THREAD: [1.16] GSC functions codes list | Random Scripts
  1. 03-09-2015, 06:58 PM
    46
    Posts
    1,467
    Reputation
    May 2013
    NextGenUpdate
    Ok so since I released how to call raw gsc functions, I thought, why not a gsc codes list?

    Make sure you call this after each function. Scr_ClearOutParams();

    THIS IS UPDATED AFTER SHARKS POST

    void Scr_ClearOutParams(){
    VariableValue* Top;
    uint Params = *(int*)(0x13C3140 + 0x1Cool Man (aka Tustin);
    *(int*)(0x13C3140 + 0x1Cool Man (aka Tustin) = 0;
    for(Top -= Params; Params; --Params){
    ((void(*)(int, VariableUnion))&ParseAddr(0x2DA724))(Top->type, Top->u); // RemoveRefToObject
    --Top;
    }
    return;
    }


    GScr_Earthquake:

    void GScr_Earthquake(float scale, float duration, float* source, float radius){
    Scr_AddFloat(radius);
    Scr_AddVector(source);
    Scr_AddFloat(duration);
    Scr_AddFloat(scale);
    Scr_SetParameters(4); //See how I set the parameter number after I finish calling the Scr_Adds?
    ((void(*)())&ParseAddr(0x268B60))(); //Call the actual function
    //((void(*)(int))&ParseAddr(0x268B60))(ClientID << 16); //Only call this one if the one above doesn't work.
    Scr_ClearOutParams();
    }


    Scr_PlayFX:

    void Scr_PlayFX(const char* EffectId, float* Position, float* Forward = 0, float* Up = 0){
    Scr_AddVector(Up);
    Scr_AddVector(Forward);
    Scr_AddVector(Position);
    Scr_AddInt(((int(*)(const char*))&ParseAddr(0x324D0))(EffectId));
    Scr_SetParameters(4);
    ((void(*)())&ParseAddr(0x2732D4))();
    Scr_ClearOutParams();
    }


    Scr_MagicBullet:

    void Scr_MagicBullet(int ClientID, const char* Bullet, float* Start, float* End){
    Scr_AddEntity(GetEntity(ClientID));
    Scr_AddVector(End);
    Scr_AddVector(Start);
    Scr_AddString(Bullet);
    Scr_SetParameters(4);
    ((void(*)())&ParseAddr(0x264800))();
    Scr_ClearOutParams();
    }


    Scr_PhysicsExplosionCylinder:

    void Scr_PhysicsExplosionCylinder(float* Origin, float OuterRadius, float InnerRadius, float Magnitude){
    Scr_AddFloat(Magnitude);
    Scr_AddFloat(InnerRadius);
    Scr_AddFloat(OuterRadius);
    Scr_AddVector(Origin);
    Scr_SetParameters(4);
    ((void(*)())&ParseAddr(0x273770))();
    //If it doesn't work, try ((void(*)(int))&ParseAddr(0x273770))(ClientID << 16);
    Scr_ClearOutParams();
    }


    GScr_SetMiniMap:

    void GScr_SetMiniMap(const char* Material, UpperLeftX, UpperLeftY, LowerRightX, LowerRightY){
    Scr_AddFloat(LowerRightY);
    Scr_AddFloat(LowerRightX);
    Scr_AddFloat(UpperLeftY);
    Scr_AddFloat(UpperLeftX);
    Scr_AddString(Material);
    Scr_SetParameters(5);
    Scr_ClearOutParams();
    }

    ___________________________Random functions___________________________

    VectorScale:

    float* VectorScale(float* Angle, int Scale){
    float Result[] = { Angle[0]* Scale, Angle[1]* Scale, Angle[2]* Scale };
    return Result;
    }


    AnglesToForward:

    #define AngleVectors(Angle, Forward, Right, Up) ((void(*)(const float*, float*, float*, float*))&ParseAddr(0x38020Cool Man (aka Tustin))(Angle, Forward, Right, Up)

    float* AnglesToForward(const float* Angle){
    float Forward[3];
    AngleVectors(Angle, Forward, 0, 0);
    return Forward;//If this doesn't work, return Angle;
    }



    GetEye: //Equivalent to GetTagOrigin("tag_eye")

    #define G_GetPlayerViewOrigin(PS, Origin) ((void(*)(int, float*))&ParseAddr(0x231884))(PS, Origin)

    float* GetEye(unsigned int ClientID){
    float Org[3];
    G_GetPlayerViewOrigin(G_Client(ClientID), Org);
    return Org;
    }


    GetCursorPos:



    #define G_LocationalTrace(Trace, Start, End, PassEnt, ContentMask, PriorityMap) ((void(*)(trace_t*, const float*, const float*, int, int, char*))&ParseAddr(0x250FA4))(Trace, Start, End, PassEnt, ContentMask, PriorityMap)
    #define Trace_GetEntityHitId(Trace) ((ushort(*)(trace_t*))&ParseAddr(0x2A9750))(Trace)

    struct BulletTraceType{
    short entnum;
    float Pos[3];
    };

    struct trace_t{//Xx jAmes t xX
    float fraction;
    byte Buffer[0x28];
    };

    void BulletTrace(BulletTraceType* Type, float* Start, float* End, unsigned int ClientID){//Xx jAmes t xX
    trace_t trace;
    G_LocationalTrace(&trace, Start, End, ClientID, 0x80A831, 0);
    for(unsigned char i = 0; i < 3; i++) Type->Pos = (((End-Start) * trace.fraction) + Start);
    short Entity = Trace_GetEntityHitId(&trace) & 0xFFFF;
    if(Entity < 0x7FE) Type->entnum= Entity;
    }

    float* GetCursorPos(unsigned int ClientID){
    BulletTraceType Type;
    BulletTrace(&Type, GetEye(), VectorScale(AnglesToForward((float*)(G_Client(ClientID) + 0x184), 100000), ClientID);
    return Type.Pos;
    }


    ___________________________Hooks that you can use___________________________

    VM_Execute:

    Address location - 0x2E6444



    int VM_ExecuteStub(){
    __asm("li %r3, 0x4");
    }

    int VM_Execute(){
    //Do stuff here
    return VM_ExecuteStub();
    }
    What you can use this for: A loop? Calling Scr_Adds?


    Scr_Notify:

    Address location - 0x28B73C



    int Scr_NotifyStub(){
    __asm("li %r3, 0x5");
    }
    #define SL_ConvertToString(StringValue) ((const char*(*)(unsigned short))&ParseAddr(0x2D894C))(StringValue)
    #define iClient *(short*)Entity

    void Scr_Notify(int Entity, short StringValue, unsigned int Paramcount){
    /*
    if(!strcmp(SL_ConvertToString(StringValue), "weapon_fired")) MagicBullet(iClient, GetEye(), GetCursorPos());
    */
    return Scr_NotifyStub(Entity, StringValue, Paramcount);
    }

    What you can use this for: Calling Scr_Adds | Waitill. Only use this if you're having crashing problems with VM_Notify



    I'll update this more when I find more functions.
    Last edited by Ambition sG ; 03-27-2015 at 09:16 PM.

  2. The Following 14 Users Say Thank You to Ambition sG For This Useful Post:

    , , , , , , , , , , , , ,

  3. 03-18-2015, 12:16 AM
    Killer Be's Avatar
    Killer Be
    Climbing up the ladder
    Killer Be's Avatar
    Killer Be
    Climbing up the ladder
    420
    Posts
    243
    Reputation
    Dec 2014
    NextGenUpdate
    someone, please make gsc menu for ghosts Happy
  4. 03-19-2015, 11:43 PM
    226
    Posts
    2,674
    Reputation
    Sep 2010
    NextGenUpdate
    Originally Posted by Black View Post
    Okay so I don't care who started what. All of you need to stop arguing. It's just a scripts thread calm yourselves.


    I was having a bad day Happy
  5. 03-27-2015, 07:29 AM
    Shark's Avatar
    Shark
    Retired.
    Shark's Avatar
    Shark
    Retired.
    1,140
    Posts
    61,349
    Reputation
    Apr 2010
    NextGenUpdate
    Originally Posted by Ambition View Post
    Ok so since I released how to call raw gsc functions, I thought, why not a gsc codes list?

    Make sure you call this after each function. Scr_ClearOutParams();

    #define Scr_ClearOutParams() ((void(*)(void))&ParseAddr(0x2E005Cool Man (aka Tustin))()


    GScr_Earthquake:

    void GScr_Earthquake(float scale, float duration, float* source, float radius){
    Scr_AddFloat(radius);
    Scr_AddVector(source);
    Scr_AddFloat(duration);
    Scr_AddFloat(scale);
    Scr_SetParameters(4); //See how I set the parameter number after I finish calling the Scr_Adds?
    ((void(*)())&ParseAddr(0x268B60))(); //Call the actual function
    //((void(*)(int))&ParseAddr(0x268B60))(ClientID << 16); //Only call this one if the one above doesn't work.
    Scr_ClearOutParams();
    }


    Scr_PlayFX:

    void Scr_PlayFX(const char* EffectId, float* Position, float* Forward = 0, float* Up = 0){
    Scr_AddVector(Up);
    Scr_AddVector(Forward);
    Scr_AddVector(Position);
    Scr_AddInt(((int(*)(const char*))&ParseAddr(0x324D0))(EffectId));
    Scr_SetParameters(4);
    ((void(*)())&ParseAddr(0x2732D4))();
    Scr_ClearOutParams();
    }


    Scr_MagicBullet:

    void Scr_MagicBullet(int ClientID, const char* Bullet, float* Start, float* End){
    Scr_AddEntity(GetEntity(ClientID));
    Scr_AddVector(End);
    Scr_AddVector(Start);
    Scr_AddString(Bullet);
    Scr_SetParameters(4);
    ((void(*)())&ParseAddr(0x264800))();
    Scr_ClearOutParams();
    }


    Scr_PhysicsExplosionCylinder:

    void Scr_PhysicsExplosionCylinder(float* Origin, float OuterRadius, float InnerRadius, float Magnitude){
    Scr_AddFloat(Magnitude);
    Scr_AddFloat(InnerRadius);
    Scr_AddFloat(OuterRadius);
    Scr_AddVector(Origin);
    Scr_SetParameters(4);
    ((void(*)())&ParseAddr(0x273770))();
    //If it doesn't work, try ((void(*)(int))&ParseAddr(0x273770))(ClientID << 16);
    Scr_ClearOutParams();
    }


    GScr_SetMiniMap:

    void GScr_SetMiniMap(const char* Material, UpperLeftX, UpperLeftY, LowerRightX, LowerRightY){
    Scr_AddFloat(LowerRightY);
    Scr_AddFloat(LowerRightX);
    Scr_AddFloat(UpperLeftY);
    Scr_AddFloat(UpperLeftX);
    Scr_AddString(Material);
    Scr_SetParameters(5);
    Scr_ClearOutParams();
    }

    ___________________________Random functions___________________________

    VectorScale:

    float* VectorScale(float* Angle, int Scale){
    float Result[] = { Angle[0]* Scale, Angle[1]* Scale, Angle[2]* Scale };
    return Result;
    }


    AnglesToForward:

    #define AngleVectors(Angle, Forward, Right, Up) ((void(*)(const float*, float*, float*, float*))&ParseAddr(0x38020Cool Man (aka Tustin))(Angle, Forward, Right, Up)

    float* AnglesToForward(const float* Angle){
    float Forward[3];
    AngleVectors(Angle, Forward, 0, 0);
    return Forward;//If this doesn't work, return Angle;
    }



    GetEye: //Equivalent to GetTagOrigin("tag_eye")

    #define G_GetPlayerViewOrigin(PS, Origin) ((void(*)(int, float*))&ParseAddr(0x231884))(PS, Origin)

    float* GetEye(unsigned int ClientID){
    float Org[3];
    G_GetPlayerViewOrigin(G_Client(ClientID), Org);
    return Org;
    }


    GetCursorPos:



    #define G_LocationalTrace(Trace, Start, End, PassEnt, ContentMask, PriorityMap) ((void(*)(trace_t*, const float*, const float*, int, int, char*))&ParseAddr(0x250FA4))(Trace, Start, End, PassEnt, ContentMask, PriorityMap)
    #define Trace_GetEntityHitId(Trace) ((ushort(*)(trace_t*))&ParseAddr(0x2A9750))(Trace)

    struct BulletTraceType{
    short entnum;
    float Pos[3];
    };

    struct trace_t{//Xx jAmes t xX
    float fraction;
    byte Buffer[0x28];
    };

    void BulletTrace(BulletTraceType* Type, float* Start, float* End, unsigned int ClientID){//Xx jAmes t xX
    trace_t trace;
    G_LocationalTrace(&trace, Start, End, ClientID, 0x80A831, 0);
    for(unsigned char i = 0; i < 3; i++) Type->Pos = (((End-Start) * trace.fraction) + Start);
    short Entity = Trace_GetEntityHitId(&trace) & 0xFFFF;
    if(Entity < 0x7FE) Type->entnum= Entity;
    }

    float* GetCursorPos(unsigned int ClientID){
    BulletTraceType Type;
    BulletTrace(&Type, GetEye(), VectorScale(AnglesToForward((float*)(G_Client(ClientID) + 0x184), 100000), ClientID);
    return Type.Pos;
    }


    ___________________________Hooks that you can use___________________________

    VM_Execute:

    Address location - 0x2E6444



    int VM_ExecuteStub(){
    __asm("li %r3, 0x4");
    }

    int VM_Execute(){
    //Do stuff here
    return VM_ExecuteStub();
    }
    What you can use this for: A loop? Calling Scr_Adds?


    Scr_Notify:

    Address location - 0x28B73C



    int Scr_NotifyStub(){
    __asm("li %r3, 0x5");
    }
    #define SL_ConvertToString(StringValue) ((const char*(*)(unsigned short))&ParseAddr(0x2D894C))(StringValue)
    #define iClient *(short*)Entity

    void Scr_Notify(int Entity, short StringValue, unsigned int Paramcount){
    /*
    if(!strcmp(SL_ConvertToString(StringValue), "weapon_fired")) MagicBullet(iClient, GetEye(), GetCursorPos());
    */
    return Scr_NotifyStub(Entity, StringValue, Paramcount);
    }

    What you can use this for: Calling Scr_Adds | Waitill. Only use this if you're having crashing problems with VM_Notify



    I'll update this more when I find more functions.


    the Scr_ClearOutParams address is incorrect, but the same process is done within each Scr_Add function meaning you don't even need to call ClearOutParams, if you try to call Scr_ClearOutParams you are gunna freeze so I suggest removing it from any function you are using it in :p
    Last edited by Shark ; 03-27-2015 at 07:31 AM.

  6. The Following 2 Users Say Thank You to Shark For This Useful Post:

    ,

  7. 04-06-2015, 07:58 PM
    44
    Posts
    240
    Reputation
    Apr 2015
    NextGenUpdate
    cool!
  8. 10-02-2015, 03:43 PM
    32
    Posts
    110
    Reputation
    Sep 2015
    NextGenUpdate
    Nice post mate
  9. 10-04-2015, 12:10 PM
    TotalModzHD's Avatar
    TotalModzHD
    Bounty hunter
    TotalModzHD's Avatar
    TotalModzHD
    Bounty hunter
    155
    Posts
    450
    Reputation
    Sep 2014
    NextGenUpdate
    where's the definition for VariableValue in Scr_ClearOutParams? sorry if i'm just being dumb :P
  10. 01-23-2017, 12:17 PM
    kaser's Avatar
    kaser
    Do a barrel roll!
    kaser's Avatar
    kaser
    Do a barrel roll!
    105
    Posts
    50
    Reputation
    Nov 2012
    NextGenUpdate
    Nice postKryptus
  11. 03-19-2018, 07:57 PM
    seumJC's Avatar
    seumJC
    Save Point
    seumJC's Avatar
    seumJC
    Save Point
    6
    Posts
    10
    Reputation
    May 2017
    NextGenUpdate
    Can you do an example for PlayerCMD_Suicide and does anyone have GetEntity function please