You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
/* Plugin Template generated by Pawn Studio */ |
|
|
|
#include <sourcemod> |
|
|
|
new Handle:cv_ip, Handle:cv_port; |
|
|
|
public Plugin:myinfo = |
|
{ |
|
name = "Ask4Connect", |
|
author = "Chefe", |
|
description = "Redirect your players (if they want) to another server", |
|
version = "1.0", |
|
url = "www.chefgaming.de" |
|
} |
|
|
|
public OnPluginStart() |
|
{ |
|
cv_ip = CreateConVar("sm_a4c_ip", "0.0.0.0", "Set to witch IP the client should be asked to connect to."); |
|
cv_port = CreateConVar("sm_a4c_port", "27015", "Set the port the client should be asked to connect to."); |
|
|
|
AutoExecConfig(true); |
|
} |
|
|
|
public OnClientConnected(client) |
|
{ |
|
CreateTimer(10.0, DisplayAsk, client); |
|
} |
|
|
|
public Action:DisplayAsk(Handle:timer, any:data) |
|
{ |
|
if (IsClientConnected(data)) |
|
{ |
|
new String:ip[50]; |
|
GetConVarString(cv_ip, ip, sizeof(ip)); |
|
new String:port[10]; |
|
GetConVarString(cv_port, port, sizeof(port)); |
|
new String:destination[50]; |
|
Format(destination, sizeof(destination), "%s:%s", ip, port); |
|
DisplayAskConnectBox(data, 120.0, destination); |
|
PrintToChat(data, "\x04Our server has moved to an other IP address, pls use the connection box displayed now upper left and save the new server IP: %s!!!", destination); |
|
} |
|
} |