Witam
Mam problem z pluginem, który ma za zadanie usuwać bronie z mapy niestety jego funkcja jest trochę kłopotliwa z racji że po wejściu na serwer gracz nie widzi modelu broni do czasu jej wybraniam.
#include <sourcemod> #include <sdktools> public Plugin:myinfo = { name = "Remove Weapons", author = "google", description = "Usuwa bronie z mapy na poczatku rundy", version = "1.0", url = "" } public OnPluginStart() { HookEventEx("player_spawn", Player_Spawn, EventHookMode_Post); HookEventEx("round_start", Weapon_Remove, EventHookMode_Pre); } public Action:Weapon_Remove(Handle:event,const String:name[],bool:dontBroadcast) { new maxent = GetMaxEntities(), String:weapon[64]; for (new i=GetMaxClients();i<maxent;i++) { if (IsValidEntity(i) && IsValidEdict(i)) { GetEdictClassname(i, weapon, sizeof(weapon)); if ( ( StrContains(weapon, "weapon_") != -1 || StrContains(weapon, "item_") != -1 ) && GetEntPropEnt(i, Prop_Data, "m_hOwnerEntity") == -1) RemoveEdict(i); } } return Plugin_Continue; } public Action:Player_Spawn(Handle:event, String:name[], bool:dontBroadcast) { int client = GetClientOfUserId(GetEventInt(event, "userid", 0)); if (IsValidPlayer(client)) { int weapon_index = GetPlayerWeaponSlot(client, 0) if (IsValidEntity(weapon_index)) { RemovePlayerItem(client, weapon_index); AcceptEntityInput(weapon_index, "kill"); } } } stock bool IsValidPlayer(client) { if(client >= 0 && client <= MaxClients && IsClientConnected(client) && !IsFakeClient(client) && IsClientInGame(client) ) return true; return false; }