←  Problemy

AMXX.pl: Support AMX Mod X i SourceMod

»

CS:GO
Crash serwera + błedy pluginu

  • +
  • -
Rellik # - zdjęcie Rellik # 25.02.2015

Witajcie, mam plugin z tego forum na noże, i jest taki błąd w logach który powoduje crashe.. coś jest nie tak z linią 417, aktualnie nie mam tych logów bo usunąłem :D. Ale proszę popatrzeć .

 

Edit. sorry za plik smx xD pojechały mi się, niewłaściwy wybrałem

Załączone pliki


Użytkownik Rellik # edytował ten post 25.02.2015 20:27
Odpowiedz

  • +
  • -
Linux' - zdjęcie Linux' 25.02.2015

podeslij plik sp :facepalm2:

 

Edit:

 

Wszedzie gdzie pobierasz index gracza, musisz sprawdzac czy jest on podlaczony bo inaczej sa bledy. Uzyj tego stocka przy pobieraniu indexa to bedzie wszystko ok.

stock bool:IsValidClient(client)
{
	if(client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
		return true;

	return false;
}
Odpowiedz

  • +
  • -
Rellik # - zdjęcie Rellik # 01.03.2015

Nie jestem ekspertem... Czyli to ma tak wyglądać?: że to dodaje na końcu pluginu i na początku tworzę zmienną?

stock bool:IsValidClient(client)
{
if(client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
return true;
 
return false;
}
Odpowiedz

  • +
  • -
Linux' - zdjęcie Linux' 02.03.2015

Stock dodajesz gdzies na koncu pluginu a na poczatku publicu w ktorym pobierasz index dodajesz warunek sprawdzajacy czy gracz jest onlline.

if(IsValidClient(client))
{
// code
}
Odpowiedz

  • +
  • -
Rellik # - zdjęcie Rellik # 03.04.2015

Mógłbyś mi podać gotowca?

Odpowiedz

  • +
  • -
Sniper Elite - zdjęcie Sniper Elite 04.04.2015

No przecież podał ci gotowca (prawie ;) )

 

Na koniec pluginu wrzucasz stocka:

stock bool:IsValidClient(client)
{
    if(client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
        return true;

    return false;
}

a to co ci sypie errorami dajesz w warunek:

if(IsValidClient(client))
{
// code
}

Czego nie rozumiesz?

Odpowiedz

  • +
  • -
sebul - zdjęcie sebul 04.04.2015

"Krótsza" wersja
stock bool:IsValidClient(client)
{
	return bool:(client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client));
}
i jak dla mnie chyba nie ma sensu sprawdzać IsClientConnected i IsClientInGame, to prawie tak samo jakby sprawdzać w amxx czy gracz żyje i jest połączony z serwerem, samo IsClientInGame wystarcza.
Odpowiedz

  • +
  • -
Rellik # - zdjęcie Rellik # 05.04.2015

Mam warunek dać tylko w tą jedną linie czy całość publica?

 

Ostatek kodu ma wyglądać tak?: 

 

public Action:OnItemPickup(Handle:event, const String:name[], bool:dontBroadcast) 
{
if(IsValidClient(client))
{
new client = GetClientOfUserId(GetEventInt(event, "userid")); 
} 
new iWeapon = GetPlayerWeaponSlot(client, 2);
new iItem;
 
switch(weapon_choose[client]) {
case 1: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE) 
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_bayonet");}
case 2: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE) 
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_gut");}
case 3: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE) 
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_flip");}
case 4: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE) 
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_m9_bayonet");}
case 5: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE) 
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_karambit");}
case 6: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE) 
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knifegg");}
case 7: if(IsValidEntity(iWeapon) && iWeapon != INVALID_ENT_REFERENCE) 
{RemovePlayerItem(client, iWeapon), RemoveEdict(iWeapon), iItem = GivePlayerItem(client, "weapon_knife_tactical");}
default: {return;}
}
EquipPlayerWeapon(client, iItem);
 
}
stock bool:IsValidClient(client)
{
return bool:(client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client));
}

Użytkownik Rellik # edytował ten post 05.04.2015 08:38
Odpowiedz

  • +
  • -
sebul - zdjęcie sebul 05.04.2015

Przed pobraniem id gracza chcesz sprawdzić czy gracz istnieje?
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(!IsValidClient(client))
	return;

new iWeapon = GetPlayerWeaponSlot(client, 2);
Odpowiedz

  • +
  • -
Rellik # - zdjęcie Rellik # 05.04.2015

Znowu crashuje serwer, nic to nie dało

Odpowiedz

  • +
  • -
Linux' - zdjęcie Linux' 05.04.2015

Znowu crashuje serwer, nic to nie dało


Widocznie crashuje cos innego. To co podalem naprawia blad o errorach o ktorych pisales na poczatku.
Odpowiedz

  • +
  • -
Rellik # - zdjęcie Rellik # 05.04.2015

Ale to ten plugin na 100%... Usunąłem go i znów jest git.

Odpowiedz