AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Spawn with molotov [flag] (https://forums.alliedmods.net/showthread.php?t=321260)

Zeddy_god 02-02-2020 00:10

Spawn with molotov [flag]
 
Yo, can someone possibly code something simple where anyone with a flag [o] spawns with a molotov?

iskenderkebab33 02-02-2020 02:25

Re: Spawn with molotov [flag]
 
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");
    }



Marttt 02-02-2020 06:14

Re: Spawn with molotov [flag]
 
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.

OhHai 02-02-2020 11:33

Re: Spawn with molotov [flag]
 
Quote:

Originally Posted by Marttt (Post 2682469)
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.

Marttt 02-02-2020 12:45

Re: Spawn with molotov [flag]
 
of course it works...


All times are GMT -4. The time now is 08:59.

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