PremyslTalich / TeamGames

Sourcemod plugin providing team based games for prisoners and some useful things for wardens.
17 stars 13 forks source link

MoreMarks inc for other plugins #9

Closed SHAREN closed 8 years ago

SHAREN commented 8 years ago

Thank You for https://github.com/KissLick/TeamGames/issues/8#event-483818524

Please Add in include something like SpawnMark (iClient, TG_BlueTeam, fX, fY, fZ); For other plugins

For example, for this plugin WARDEN https://github.com/FoxSerito/sm_jail_warden/blob/master/sm_jail_warden.sp#L936 or any shop.

for example in the configs/teamgames/moremarks.cfg addition to red, and blue, you can add more others Marks and others plugins can use these.

SHAREN commented 8 years ago

For exapmle i don't want to use use+attack and want to shift+use to place marks

public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
    if (!GetConVarBool(g_hAllowMark) || g_iMarkLimitCounter >= GetConVarInt(g_hMarkLimit))
        return Plugin_Continue;

    if (Client_IsIngame(client) && IsPlayerAlive(client) && GetClientTeam(client) == CS_TEAM_CT && g_PlayerData[client][AbleToMark]) {

        if (GetClientButtons(client) & IN_USE && GetClientButtons(client) & IN_SPEED && !g_bIsPaintingRed[client])
        {
            decl Float:g_fOrigin[3], Float:g_fAngles[3];

            GetClientEyePosition(client, g_fOrigin);
            GetClientEyeAngles(client, g_fAngles);

            TR_TraceRayFilter(g_fOrigin, g_fAngles, MASK_SOLID, RayType_Infinite, Trace_FilterPlayers, client);

            if(TR_DidHit(INVALID_HANDLE))
            {

                TR_GetEndPosition(g_fOrigin, INVALID_HANDLE);
                TR_GetPlaneNormal(INVALID_HANDLE, g_fAngles);
                GetVectorAngles(g_fAngles, g_fAngles);
                g_fAngles[0] += 90.0;
            }
            SpawnMark(client, TG_RedTeam, g_fOrigin[0], g_fOrigin[1], g_fOrigin[2]);
            PrintToChatAll("TG_RedTeam %.2f %.2f %.2f",g_fOrigin[0], g_fOrigin[1], g_fOrigin[2]);
            g_bIsPaintingRed[client] = true;
            CreateTimer(0.02, StopRedPaint, client);
        }
    }
    return Plugin_Continue;
}

public bool:Trace_FilterPlayers(entity, contentsMask, any:data)
{
    if(entity != data && entity > MaxClients){
        return true;
    }
    return false;
}

public Action:StopRedPaint(Handle:timer, any:client)
{
    g_bIsPaintingRed[client] = false;
}

public Action:Timer_MarkLimit(Handle:hTimer)
{
    if (g_iMarkLimitCounter > 0)
        g_iMarkLimitCounter--;

    return Plugin_Continue;
}
PremyslTalich commented 8 years ago

I am kinda unsure about that. Anyway you can make a simple plugin using TG_SpawnMark to add new method of spawning marks.

Just use it with MoreMarks and it should be OK.

if (GetClientButtons(client) & IN_USE && GetClientButtons(client) & IN_SPEED && !g_bIsPaintingRed[client])
        {
            decl Float:g_fOrigin[3], Float:g_fAngles[3];

            GetClientEyePosition(client, g_fOrigin);
            GetClientEyeAngles(client, g_fAngles);

            TR_TraceRayFilter(g_fOrigin, g_fAngles, MASK_SOLID, RayType_Infinite, Trace_FilterPlayers, client);

            if(TR_DidHit(INVALID_HANDLE))
            {

                TR_GetEndPosition(g_fOrigin, INVALID_HANDLE);
                TR_GetPlaneNormal(INVALID_HANDLE, g_fAngles);
                GetVectorAngles(g_fAngles, g_fAngles);
                g_fAngles[0] += 90.0;
            }
            TG_SpawnMark(client, TG_RedTeam, g_fOrigin, _, _, true); // <--- HERE
            PrintToChatAll("TG_RedTeam %.2f %.2f %.2f",g_fOrigin[0], g_fOrigin[1], g_fOrigin[2]);
            g_bIsPaintingRed[client] = true;
            CreateTimer(0.02, StopRedPaint, client);
        }

EDIT: And set tg_mark_allow 0 + tg_mark_nobullet 0.