View Single Post
Author Message
mrmiki
Junior Member
Join Date: Mar 2021
Old 08-18-2021 , 14:56   a little help please
Reply With Quote #1

hi
im trying get players awp weapon
i dont know what is wrong!
it is no working



HTML Code:
#include <sourcemod>
#include <sdktools>

new countawp=0;
new String:weaponlist2[1024] = "weapon_awp";

public OnPluginStart()
{
    HookEvent("player_spawn", Event_PlayerSpawn);
    countawp=0;
}
public OnMapStart()
{
    countawp=0;
}

public Action Event_PlayerSpawn(Handle event, const char[] name, bool dontBroadcast) 
{
    int client = GetClientOfUserId(GetEventInt(event, "userid"));
    CreateTimer(0.5, Timer1, GetClientUserId(client), TIMER_REPEAT);
    countawp=0;
}

public Action Timer1(Handle timer, any userid)
{
    
    
    if(GameRules_GetProp("m_bWarmupPeriod") == 0)
    {
        for (new i = 0; i < MaxClients; i++)
        {
            new iWeapon = GetPlayerWeaponSlot(i, 0);
            char WeaponName2[32];
            GetEdictClassname(iWeapon, WeaponName2, sizeof(WeaponName2));
            if(!StrContains(weaponlist2, WeaponName2, false))
                {
                countawp++;
                }
            PrintToChatAll(" \x02AWP = %i", countawp);
        }
    }
    return Plugin_Continue;
}
mrmiki is offline