KimPix Napisano 26 Grudnia 2018 (edytowane) Witam, mam linijke GivePlayerItem(i, "weapon_knife"); // "i" to jest client i jak ja mam to podczas ladowanie serwera, ladowanie zatrzymuje sie na pobieranie danych i stoi Wie ktos jak naprawic? linijka jest w Event_PlayerSpawn Edytowane 26 Grudnia 2018 przez KimPix Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Brum Brum Napisano 26 Grudnia 2018 Pokaż cały event Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
KimPix Napisano 26 Grudnia 2018 @Brum Brum public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MAXPLAYERS; i++) { if(GetClientTeam(i) == CS_TEAM_CT && IsClientInGame(i) && IsPlayerAlive(i)) { CreateTimer(0.1, setCTModel, i); } else { //int client = GetClientOfUserId(GetEventInt(event, "userid")); int weapon; for(int y = 0; y < 5; y++) { if((weapon = GetPlayerWeaponSlot(i, y)) != -1) { SDKHooks_DropWeapon(i, weapon, NULL_VECTOR, NULL_VECTOR); AcceptEntityInput(weapon, "Kill"); } } GivePlayerItem(i, "weapon_knife"); CreateTimer(0.1, setTT, i); } } } //jak daje do round start to przy starcie rundy serwer crashuje Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Paweł 1 Napisano 26 Grudnia 2018 public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MAXPLAYERS; i++) { if(GetClientTeam(i) == CS_TEAM_CT && IsClientInGame(i) && IsPlayerAlive(i)) { CreateTimer(0.1, setCTModel, i); } else { //int client = GetClientOfUserId(GetEventInt(event, "userid")); int weapon; for(int y = 0; y < 5; y++) { if((weapon = GetPlayerWeaponSlot(i, y)) != -1) { SDKHooks_DropWeapon(i, weapon, NULL_VECTOR, NULL_VECTOR); AcceptEntityInput(weapon, "Kill"); } } int knife = GivePlayerItem(i, "weapon_knife"); EquipPlayerWeapon(i, knife); CreateTimer(0.1, setTT, i); } } } Spróbuj tego , ewentualnie możesz podać jeszcze error logi. Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
KimPix Napisano 26 Grudnia 2018 @Yamakashi nie działa, skąd te error logi wziąć? w konsoli nic nie ma Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Brum Brum 1 Napisano 26 Grudnia 2018 Jak już usuwasz broń w taki sposób Spoiler int weapon; for (int y = 0; y < 5; y++) { if ((weapon = GetPlayerWeaponSlot(i, y)) != -1) { SDKHooks_DropWeapon(i, weapon, NULL_VECTOR, NULL_VECTOR); AcceptEntityInput(weapon, "Kill"); } } To czemu nie zrobisz tego tak? Spoiler for (int y = 0; y < 5; i++) { int weapon = GetPlayerWeaponSlot(client, i); if (weapon != -1)RemoveEdict(weapon); } Jeżeli nie jest to związane z usuwaniem broni pokaż co się znajduje w setCTModel oraz setTT Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
KimPix Napisano 26 Grudnia 2018 @Brum Brum public Action setCTModel(Handle timer, int client) { SetEntityModel(client, ctModel); SetEntityArms(client, ctModelArms); CS_SetClientClanTag(client, "-tag-"); } public Action setTT(Handle timer, int client) { SetEntityModel(client, ttModel); SetEntityArms(client, ttModelArms); CS_SetClientClanTag(client, "-tag-"); } Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Paweł Napisano 26 Grudnia 2018 addons/sourcemod/logs/ Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
KimPix Napisano 26 Grudnia 2018 (edytowane) @Yamakashi L 12/26/2018 - 21:35:38: SourceMod error session started L 12/26/2018 - 21:35:38: Info (map "jb_facebook") (file "errors_20181226.log") L 12/26/2018 - 21:35:38: [SM] Exception reported: Client 2 is not in game L 12/26/2018 - 21:35:38: [SM] Blaming: JailBreak.smx L 12/26/2018 - 21:35:38: [SM] Call stack trace: L 12/26/2018 - 21:35:38: [SM] [0] GetClientTeam L 12/26/2018 - 21:35:38: [SM] [1] Line 102, C:\Users\KimPix\Desktop\Projekty\projekty SP\JailBreak\JailBreak.sp::Event_PlayerSpawn L 12/26/2018 - 21:35:42: [SM] Exception reported: Client 2 is not in game L 12/26/2018 - 21:35:42: [SM] Blaming: JailBreak.smx L 12/26/2018 - 21:35:42: [SM] Call stack trace: L 12/26/2018 - 21:35:42: [SM] [0] GetClientTeam L 12/26/2018 - 21:35:42: [SM] [1] Line 102, C:\Users\KimPix\Desktop\Projekty\projekty SP\JailBreak\JailBreak.sp::Event_PlayerSpawn L 12/26/2018 - 21:35:42: [SM] Exception reported: Client 2 is not in game L 12/26/2018 - 21:35:42: [SM] Blaming: JailBreak.smx L 12/26/2018 - 21:35:42: [SM] Call stack trace: L 12/26/2018 - 21:35:42: [SM] [0] GetClientTeam L 12/26/2018 - 21:35:42: [SM] [1] Line 102, C:\Users\KimPix\Desktop\Projekty\projekty SP\JailBreak\JailBreak.sp::Event_PlayerSpawn L 12/26/2018 - 21:35:42: [SM] Exception reported: Client 2 is not in game L 12/26/2018 - 21:35:42: [SM] Blaming: JailBreak.smx L 12/26/2018 - 21:35:42: [SM] Call stack trace: L 12/26/2018 - 21:35:42: [SM] [0] GetClientTeam L 12/26/2018 - 21:35:42: [SM] [1] Line 309, C:\Users\KimPix\Desktop\Projekty\projekty SP\JailBreak\JailBreak.sp::Event_RoundStart Edytowane 26 Grudnia 2018 przez KimPix Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Brum Brum Napisano 26 Grudnia 2018 (edytowane) Spróbuj tego Spoiler public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MAXPLAYERS; i++) { if (IsValidClient(i) && IsPlayerAlive(i)) { if (GetClientTeam(i) == CS_TEAM_CT) { CreateTimer(0.1, setCTModel, i); } else { //int client = GetClientOfUserId(GetEventInt(event, "userid")); for (int y = 0; y < 5; y++) { int weapon = GetPlayerWeaponSlot(i, y); if (weapon != -1)RemoveEdict(weapon); } GivePlayerItem(i, "weapon_knife"); CreateTimer(0.1, setTT, i); } } } } public bool IsValidClient(int client) { if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || !IsClientConnected(client) || IsFakeClient(client) || IsClientSourceTV(client)) return false; return true; } errory na pewno zniknął Edytowane 26 Grudnia 2018 przez Brum Brum Tekst w code blocku Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Paweł Napisano 26 Grudnia 2018 (edytowane) public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MAXPLAYERS; i++) { if(IsClientInGame(i) && IsPlayerAlive(i)) { if(GetClientTeam(i) == CS_TEAM_CT) { CreateTimer(0.1, setCTModel, i); } else { int weapon; for (int y = 0; y < 5; i++) { int weapon = GetPlayerWeaponSlot(client, i); if (weapon != -1)RemoveEdict(weapon); } } int knife = GivePlayerItem(i, "weapon_knife"); EquipPlayerWeapon(i, knife); CreateTimer(0.1, setTT, i); } } } Podaj jeszcze kod z Event_RoundStart @Edit poprawiam kod Edytowane 26 Grudnia 2018 przez Yamakashi Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
KimPix Napisano 26 Grudnia 2018 @Brum Brum if (IsValidClient(i) && IsPlayerAlive(i)) { //tutaj <-- invalid expression, assumed zero @Yamakashi public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast) { mk = false; warden = ""; Open = false; RoundCount++; for (int i = 1; i < MAXPLAYERS; i++) { if(GetClientTeam(i) == CS_TEAM_T && IsClientInGame(i)) { int random = GetRandomInt(0, 5); switch(random) { //case z wiadomosciami } } else if(GetClientTeam(i) == CS_TEAM_CT && IsClientInGame(i)) { PrintToChat(i, " \x0E[\x02JB\x0E] \x01Dzień \x02%d\x01, jesteś \x04strażnikiem\x01!", RoundCount); } } } Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Brum Brum Napisano 26 Grudnia 2018 1 minutę temu, KimPix napisał: @Brum Brum if (IsValidClient(i) && IsPlayerAlive(i)) { //tutaj <-- invalid expression, assumed zero @Yamakashi public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast) { mk = false; warden = ""; Open = false; RoundCount++; for (int i = 1; i < MAXPLAYERS; i++) { if(GetClientTeam(i) == CS_TEAM_T && IsClientInGame(i)) { int random = GetRandomInt(0, 5); switch(random) { //case z wiadomosciami } } else if(GetClientTeam(i) == CS_TEAM_CT && IsClientInGame(i)) { PrintToChat(i, " \x0E[\x02JB\x0E] \x01Dzień \x02%d\x01, jesteś \x04strażnikiem\x01!", RoundCount); } } } Mi normalnie skompilowało, nie masz nigdzie indziej IsValidClient? Na bieżąco testuje plugin Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
KimPix Napisano 26 Grudnia 2018 @Brum Brum nie mam Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Brum Brum Napisano 26 Grudnia 2018 8 minut temu, Yamakashi napisał: public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MAXPLAYERS; i++) { if(IsClientInGame(i) && IsPlayerAlive(i)) { if(GetClientTeam(i) == CS_TEAM_CT) { CreateTimer(0.1, setCTModel, i); } else { int weapon; for (int y = 0; y < 5; i++) { int weapon = GetPlayerWeaponSlot(client, i); if (weapon != -1)RemoveEdict(weapon); } } int knife = GivePlayerItem(i, "weapon_knife"); EquipPlayerWeapon(i, knife); CreateTimer(0.1, setTT, i); } } } Podaj jeszcze kod z Event_RoundStart @Edit poprawiam kod Masz w kodzie dwa razy int weapon więc się nawet nie skompiluje Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
KimPix Napisano 26 Grudnia 2018 mam 1 raz Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Brum Brum Napisano 26 Grudnia 2018 1 minutę temu, KimPix napisał: @Brum Brum nie mam Kod który mam aktualnie. Mi działa Spoiler #include <sdktools> #define CS_TEAM_CT 3 public void OnPluginStart() { HookEvent("player_spawn", Event_PlayerSpawn); } public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MAXPLAYERS; i++) { if (IsValidClient(i) && IsPlayerAlive(i)) { if (GetClientTeam(i) == CS_TEAM_CT) { CreateTimer(0.1, setCTModel, i); } else { //int client = GetClientOfUserId(GetEventInt(event, "userid")); for (int y = 0; y < 5; y++) { int weapon = GetPlayerWeaponSlot(i, y); if (weapon != -1)RemoveEdict(weapon); } GivePlayerItem(i, "weapon_knife"); CreateTimer(0.1, setTT, i); } } } } public bool IsValidClient(int client) { if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || !IsClientConnected(client) || IsFakeClient(client) || IsClientSourceTV(client)) return false; return true; } Jaką masz wersję kompilatora? Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Paweł Napisano 26 Grudnia 2018 Teraz wszystko powinno działać public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast) { mk = false; warden = ""; Open = false; RoundCount++; for (int i = 1; i < MAXPLAYERS; i++) { if(IsValidClient(i)) { if(GetClientTeam(i) == CS_TEAM_T) { int random = GetRandomInt(0, 5); switch(random) { //case z wiadomosciami } } else if(GetClientTeam(i) == CS_TEAM_CT) { PrintToChat(i, " \x0E[\x02JB\x0E] \x01Dzień \x02%d\x01, jesteś \x04strażnikiem\x01!", RoundCount); } } } } public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MAXPLAYERS; i++) { if(IsValidClient(i) && IsPlayerAlive(i)) { if(GetClientTeam(i) == CS_TEAM_CT) { CreateTimer(0.1, setCTModel, i); } else { for (int y = 0; y < 5; i++) { int weapon = GetPlayerWeaponSlot(client, i); if (weapon != -1)RemoveEdict(weapon); } } int knife = GivePlayerItem(i, "weapon_knife"); EquipPlayerWeapon(i, knife); CreateTimer(0.1, setTT, i); } } } stock bool IsValidClient(int client) { if(client <= 0 ) return false; if(client > MaxClients) return false; if(!IsClientConnected(client)) return false; if(IsFakeClient(client)) return false; return IsClientInGame(client); } Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
KimPix Napisano 26 Grudnia 2018 @Brum Brum dobra juz kompile Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
KimPix Napisano 26 Grudnia 2018 @Yamakashi public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MAXPLAYERS; i++) { if(IsValidClient(i) && IsPlayerAlive(i)) { if(GetClientTeam(i) == CS_TEAM_CT) { CreateTimer(0.1, setCTModel, i); } else { for (int y = 0; y < 5; i++) { int weapon = GetPlayerWeaponSlot(i, i); if (weapon != -1)RemoveEdict(weapon); } } int knife = GivePlayerItem(i, "weapon_knife"); EquipPlayerWeapon(i, knife); CreateTimer(0.1, setTT, i); } } <-- 3x invalid expression assumed zero; too many error messenges on one line } Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Paweł 1 Napisano 26 Grudnia 2018 public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MAXPLAYERS; i++) { if(IsValidClient(i) && IsPlayerAlive(i)) { if(GetClientTeam(i) == CS_TEAM_CT) { CreateTimer(0.1, setCTModel, i); } else { for (int y = 0; y < 5; i++) { int weapon = GetPlayerWeaponSlot(client, i); if (weapon != -1)RemoveEdict(weapon); } int knife = GivePlayerItem(i, "weapon_knife"); EquipPlayerWeapon(i, knife); CreateTimer(0.1, setTT, i); } } } } Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
KimPix Napisano 26 Grudnia 2018 @Yamakashi nadal i tam dales int weapon = GetPlayerWeaponSlot(client, i); kiedy nie ma zdefiniowanego clienta Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
NWayne Napisano 26 Grudnia 2018 Podziel sobie na funkcje. Spoiler stock void StripAllWeapons(int client) { int iEnt; for (int i = 0; i <= 2; i++) { while ((iEnt = GetPlayerWeaponSlot(client, i)) != -1) { RemovePlayerItem(client, iEnt); AcceptEntityInput(iEnt, "Kill"); } } } Cytat else { StripAllWeapons(i); GivePlayerItem(i, "weapon_knife"); CreateTimer(0.1, setTT, i); } Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Paweł 1 Napisano 26 Grudnia 2018 @Kimpix spróbuj tego , mi kompiluje bez problemu. public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { for (int i = 1; i <= MAXPLAYERS; i++) { if (IsValidClient(i) && IsPlayerAlive(i)) { if (GetClientTeam(i) == CS_TEAM_CT) { CreateTimer(0.1, setCTModel, i); } else { int client = GetClientOfUserId(GetEventInt(event, "userid")); for (int y = 0; y < 5; y++) { int weapon = GetPlayerWeaponSlot(client, i); if (weapon != -1) { RemoveEdict(weapon); } } int knife = GivePlayerItem(i, "weapon_knife"); EquipPlayerWeapon(i, knife); CreateTimer(0.1, setTT, i); } } } } Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach
Brum Brum 1 Napisano 26 Grudnia 2018 ^^ To co wysłał Yamakashi działa(wysyłałem prawie to samo tylko inaczej nóż dawałem) Jeżeli Ci nie działa ponownie spójrz czy masz zprecachowane modele, jeżeli nie masz znamy powód crasha Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach