over Opublikowano Styczeń 6, 2016 o 16:03 Udostępnij Opublikowano Styczeń 6, 2016 o 16:03 Witam zabrałem się za modyfikację pluginu https://forums.alliedmods.net/showthread.php?t=153769 Chciałem dodać możliwość łączenia się z serwerem z hasłem. Zmodyfikowałem plugin. #include <sourcemod> new Handle:g_hNewIP = INVALID_HANDLE; new Handle:g_hTimer = INVALID_HANDLE; new Handle:g_hShowTime = INVALID_HANDLE; new Handle:g_hTimers[MAXPLAYERS + 1] = INVALID_HANDLE; new Handle:g_pass = INVALID_HANDLE; public Plugin:myinfo = { name = "Zmiana ip", author = "krzychu", description = "Zmiana serwera", version = "1.0", }; public OnPluginStart() { HookEvent("player_spawn", EventSpawn); g_hNewIP = CreateConVar("sm_redirect_newip", "0.0.0.0", "Set to your new IP.", FCVAR_PLUGIN); g_hTimer = CreateConVar("sm_redirect_kicktimer", "120", "Seconds to kick after not leaving.", FCVAR_PLUGIN); g_hShowTime = CreateConVar("sm_redirect_showtimer", "120", "Seconds to show connection display box.", FCVAR_PLUGIN); g_pass = CreateConVar("your_pass", "pass", "Haslo do nowego serwera.", FCVAR_PLUGIN); } public OnClientPostAdminCheck(client) { if (IsClientInGame(client)) g_hTimers[client] = CreateTimer(GetConVarFloat(g_hTimer), IdlerKick, client, TIMER_FLAG_NO_MAPCHANGE); } public OnClientDisconnect(client) { if(g_hTimers[client] != INVALID_HANDLE) KillTimer(g_hTimers[client]); } public EventSpawn(Handle:event, const String:name[], bool:dontBroadcast) { new client = GetClientOfUserId(GetEventInt(event, "userid")); new Float:fTime = GetConVarFloat(g_hShowTime); new String:sIP[32]; new String:pass[32]; GetConVarString(g_pass, pass, sizeof(pass)); GetConVarString(g_hNewIP, sIP, sizeof(sIP)); DisplayAskConnectBox(client, fTime, sIP, pass); PrintToChat(client, "[SM] We have a new server at IP: %s", sIP); PrintToChat(client, "[SM] Press F3 (unless changed) to connect to the new server."); PrintToChat(client, "[SM] If you do not connect, you will be kicked from this server."); } public Action:IdlerKick(Handle:timer, any:client) { decl String:sBuffer[32]; GetConVarString(g_hNewIP, sBuffer, sizeof(sBuffer)); if (IsClientInGame(client)) KickClient(client, "We have moved to a new server!\nPlease update your favorites list:\nNew IP: %s", sBuffer); } Cvar jest pobierany poprawnie, odpowiednio zostaje wczytany do zmiennej typu string. Niestety połączenie z serwerem z hasłem jest niemożliwe. Gdyż wynik w konsoli jest następujący. connect 127.0.0.0:27015/haslo powinno być connect 127.0.0.0:27015; password haslo Z góry dziekuje za porady i pomoc. Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi
Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto
Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.
Zarejestruj nowe konto
Załóż nowe konto. To bardzo proste!
Zarejestruj sięZaloguj się
Posiadasz już konto? Zaloguj się poniżej.
Zaloguj się