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

Trying to target a client that is not ingame after verification


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
andrept4
Senior Member
Join Date: Dec 2012
Location: Portugal
Old 03-29-2020 , 21:23   Trying to target a client that is not ingame after verification
Reply With Quote #1

I made this plugin:

Code:
#pragma semicolon 1

#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <colors.inc>

#pragma newdecls required

public void OnPluginStart()
{
	HookEvent("round_start", OnRoundStart);
	HookEvent("round_end", OnRoundEnd);
}

public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast) {
	for (int i = 1; i <= MaxClients; i++) {
		if(IsPlayerAlive(i) && IsClientInGame(i)) {
			if((GetUserFlagBits(i) & ADMFLAG_RESERVATION) == ADMFLAG_RESERVATION) {
				SetEntProp(i, Prop_Send, "m_ArmorValue", 100.0, 1);
				if((GetUserFlagBits(i) & ADMFLAG_CUSTOM1) == ADMFLAG_CUSTOM1) {
					if(GetClientTeam(i) == CS_TEAM_CT) {
						if(!GetEntProp(i, Prop_Data, "m_bHasDefuser")) {
							GivePlayerItem(i, "item_defuser");
							CPrintToChat(i, "{darkred}[PUNT]{default} Recebeste o defuse kit por seres Sponsor!!!");
						}
					}
					SetEntProp(i, Prop_Send, "m_bHasHelmet", 1);
				}
				GivePlayerItem(i, "weapon_hegrenade");
				GivePlayerItem(i, "weapon_flashbang");
				GivePlayerItem(i, "weapon_smokegrenade");
				if(GetClientTeam(i) == CS_TEAM_CT) {
					GivePlayerItem(i, "weapon_incgrenade");
				} else if(GetClientTeam(i) == CS_TEAM_T) {
					GivePlayerItem(i, "weapon_molotov");
				}
				
				CPrintToChat(i, "{darkred}[PUNT]{default} Recebeste granadas por seres VIP!!!");
			}
		}
	}
	
	return Plugin_Handled;
}

public Action OnRoundEnd(Event event, const char[] name, bool dontBroadcast) {
	
	for (int i = 1; i <= MaxClients; i++) {
		if(IsPlayerAlive(i) && IsClientInGame(i)) {
			if((GetUserFlagBits(i) & ADMFLAG_RESERVATION) == ADMFLAG_RESERVATION) {
				int ent = -1;
				while((ent = GetPlayerWeaponSlot(i, CS_SLOT_GRENADE)) != -1) {
					if(IsValidEntity(ent)) {
						RemovePlayerItem(i, ent);
						AcceptEntityInput(ent, "Kill");
					}
				}
			}
		}
	}
	
	return Plugin_Handled;
}
and it stops working after first round and this error shows up in the log:

Spoiler
__________________
andrept4 is offline
 


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 09:44.


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