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

Spawn with molotov [flag]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zeddy_god
Senior Member
Join Date: May 2015
Location: Mumbai, India
Old 02-02-2020 , 00:10   Spawn with molotov [flag]
Reply With Quote #1

Yo, can someone possibly code something simple where anyone with a flag [o] spawns with a molotov?
__________________
Zeddy_god is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 02-02-2020 , 02:25   Re: Spawn with molotov [flag]
Reply With Quote #2

not tested but should work.

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

#pragma newdecls required

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawnEventHookMode_Post);
}

public 
void Event_PlayerSpawn(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
    
int iUser hEvent.GetInt("userid");
    
    if (
IsClientInGame(GetClientOfUserId(iUser))) {
        
CreateTimer(0.7Timer_DelayiUser);
    }
}

public 
Action Timer_Delay(Handle hTimerint iUser)
{
    
int client GetClientOfUserId(iUser);
    
    if (
IsClientInGame(client) && GetUserFlagBits(client) & ADMFLAG_CUSTOM1) {
        
GivePlayerItem(client"weapon_molotov");
    }


Last edited by iskenderkebab33; 02-02-2020 at 02:26.
iskenderkebab33 is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 02-02-2020 , 06:14   Re: Spawn with molotov [flag]
Reply With Quote #3

In some games, player_spawn (e.g. L4D2) can be called a lot of times for the same player, so If u experience some kind of bug, I recommend to use OnClientPostAdminCheck instead.
__________________
Marttt is offline
OhHai
Junior Member
Join Date: Aug 2019
Old 02-02-2020 , 11:33   Re: Spawn with molotov [flag]
Reply With Quote #4

Quote:
Originally Posted by Marttt View Post
In some games, player_spawn (e.g. L4D2) can be called a lot of times for the same player, so If u experience some kind of bug, I recommend to use OnClientPostAdminCheck instead.
That absolutely will not work whatsoever.
OhHai is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 02-02-2020 , 12:45   Re: Spawn with molotov [flag]
Reply With Quote #5

of course it works...
__________________
Marttt is offline
Reply


Thread Tools
Display Modes

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 16:24.


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