Raised This Month: $51 Target: $400
 12% 

Solved How to force set weapon when player spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-05-2018 , 13:08   How to force set weapon when player spawn
Reply With Quote #1

Hello some map (hide and seek) has set mp_t_default_secondary weapon_knife and mp_ct_default_secondary weapon_knife and i can't modify that with plugin or with rcon commands

I have this script to force health points, but could you modify this to force secondary weapon to deagle and knife for ct and t ?
Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    HookEvent("player_spawn", Event_PlayerSpawn);
}

public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
    RequestFrame(Frame_Callback, event.GetInt("userid"));
}

public void Frame_Callback(int userid)
{
    int client = GetClientOfUserId(userid);
    if (client && IsClientInGame(client) && IsPlayerAlive(client))
    {
        if (GetClientTeam(client) == 2)
        {
            CreateTimer(2.0, Timer_Callback, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
        } else {
            SetEntityHealth(client, 999);
        }
    }
}

public Action Timer_Callback(Handle timer, int userid)
{
    int client = GetClientOfUserId(userid);
    if (client && IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == 2)
    {
        SetEntityHealth(client, 100);
    }
}

or maybe just a script give deagle when player spawn.

Sorry for my bad english, and it's my last request for my serveur hide and seek.

And thanks to people who help me to create scripts !

Last edited by vegeta1241; 10-05-2018 at 21:16.
vegeta1241 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-05-2018 , 13:33   Re: How to force set weapon when player spawn
Reply With Quote #2

GivePlayerItem(client, "weapon_deagle");
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-05-2018 , 21:17   Re: How to force set weapon when player spawn
Reply With Quote #3

Thanks !
vegeta1241 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:13.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode