Conflicts:
	data/languages/french.txt
	src/engine/client/client.cpp
	src/engine/server/server.cpp
	src/game/server/gamecontext.cpp
This commit is contained in:
GreYFoXGTi 2010-10-11 03:56:58 +02:00
commit d8e6cfcbdd
21 changed files with 411 additions and 331 deletions

View file

@ -4,12 +4,39 @@
%d of %d servers, %d players %d of %d servers, %d players
== %d/%d serveurs, %d joueurs == %d/%d serveurs, %d joueurs
%ds left
== %ds a quitté
[N] Flip brush horizontal
== [N] Retourner horizontalement
[NumPad+] Zoom in
== [ClavierNum+] Zoomer
[NumPad-] Zoom out
== [ClavierNum-] Dézoomer
[M] Flip brush vertical
== [M] Retourner verticalement
Abort Abort
== Annuler == Annuler
Add
== Ajouter
Add group
== Ajouter un groupe
Add Image
== Ajouter une image
Address Address
== Adresse == Adresse
Adds a new group
== Ajoute un nouveau groupe
All All
== Tout le monde == Tout le monde
@ -19,6 +46,15 @@ Alpha
Always show name plates Always show name plates
== Toujours afficher les pseudonymes == Toujours afficher les pseudonymes
Anim
== Anim.
Append
== Joindre
Append map
== Joindre une carte
Are you sure that you want to quit? Are you sure that you want to quit?
== Êtes-vous sûr de vouloir quitter ? == Êtes-vous sûr de vouloir quitter ?
@ -34,15 +70,27 @@ Blue team wins!
Body Body
== Corps == Corps
Border
== Bordure
Call vote Call vote
== Voter == Voter
Cancel
== Annuler
Chat Chat
== Chat == Chat
Clear collision
== Nettoyer la collision
Close Close
== Fermer == Fermer
Color+
== Couleur+
Compatible version Compatible version
== Version compatible == Version compatible
@ -52,12 +100,21 @@ Connect
Connecting to Connecting to
== Connexion à == Connexion à
Connection Problems...
== Problèmes de connexion...
Console Console
== Console == Console
Controls Controls
== Contrôles == Contrôles
Constructs collision from this layer
== Fait la collision depuis cette couche
Creates a new map
== Crée une nouvelle carte
Current Current
== Actuellement == Actuellement
@ -67,9 +124,30 @@ Current version: %s
Custom colors Custom colors
== Couleurs personnalisées == Couleurs personnalisées
Decrease
== Réduire
Decrease animation speed
== Réduire la vitesse des animations
Delete
== Supprimer
Delete group
== Supprimer le groupe
Delete layer
== Supprimer la couche
Deletes the layer
== Supprime la couche
Demos Demos
== Démos == Démos
Detail
== Détail
Disconnect Disconnect
== Partir == Partir
@ -88,17 +166,38 @@ Draw!
Dynamic Camera Dynamic Camera
== Caméra dynamique == Caméra dynamique
Embed
== Intégrer
Embedded
== Intégré
Embeds the image into the map file.
== Intègre l'image dans la carte.
Emoticon Emoticon
== Émoticônes == Émoticônes
Enter Enter
== Démarrer == Démarrer
Error
== Erreur
error loading demo
== erreur de chargement de la démo
Exits from the editor
== Ferme l'éditeur
External
== Externe
FSAA samples FSAA samples
== Échantillons FSAA == Échantillons FSAA
Favorite Favorite
== Favoris == Favori
Favorites Favorites
== Favoris == Favoris
@ -106,6 +205,12 @@ Favorites
Feet Feet
== Pieds == Pieds
File
== Fichier
Filename:
== Nom du fichier:
Filter Filter
== Filtre == Filtre
@ -142,12 +247,18 @@ Graphics
Grenade Grenade
== Lance-grenade == Lance-grenade
Group
== Groupe
Hammer Hammer
== Maillet == Maillet
Has people playing Has people playing
== Au moins un joueur == Au moins un joueur
Height
== Hauteur
High Detail High Detail
== Tous les détails == Tous les détails
@ -160,6 +271,18 @@ Host address
Hue Hue
== Teinte == Teinte
Image
== Image
Images
== Images
Increase
== Augmenter
Increase animation speed
== Augmenter la vitesse des animations
Info Info
== Info. == Info.
@ -187,15 +310,27 @@ LAN
Language Language
== Langue == Langue
Layers
== Couches
Lht. Lht.
== Lum. == Lum.
Load a new image to use in the map
== Charger une image pour l'utiliser dans la carte
Loading DDRace Client Loading DDRace Client
== Chargement DDRace Client == Chargement DDRace Client
MOTD MOTD
== MOTD == MOTD
Make collision
== Faire la collision
Make external
== Mettre en externe
Map Map
== Carte == Carte
@ -223,6 +358,9 @@ Mute when not active
Name Name
== Nom == Nom
New
== Nouveau
News News
== Nouvelles == Nouvelles
@ -232,6 +370,9 @@ Next weapon
Nickname Nickname
== Pseudonyme == Pseudonyme
Name:
== Nom:
No No
== Non == Non
@ -244,13 +385,34 @@ No servers found
No servers match your filter criteria No servers match your filter criteria
== Aucun serveur ne correspond à vos critères == Aucun serveur ne correspond à vos critères
None
== Aucun
Normal animation speed
== Vitesse normale des animations
Ok Ok
== Ok == Ok
Open
== Ouvrir
Open map
== Ouvrir une carte
Opens a map and adds everything from that map to the current one
== Ouvre une carte et ajoute son contenu dans la carte actuelle
Opens a map for editing
== Ouvre une carte pour la modifier
Order
== Ordre
Password Password
== Mot de passe == Mot de passe
Password Incorrect Password incorrect
== Mot de passe incorrect == Mot de passe incorrect
Ping Ping
@ -268,6 +430,15 @@ Player
Players Players
== Joueurs == Joueurs
Please balance teams!
== Équilibrez les équipes !
Pos.+
== Pos.+
Press right mouse button to create a new point
== Clic-droit pour créer un nouveau point
Prev. weapon Prev. weapon
== Arme précédente == Arme précédente
@ -275,7 +446,7 @@ Quality Textures
== Textures haute qualité == Textures haute qualité
Quick search: Quick search:
== Recherche rapide: == Recherche rapide :
Quit Quit
== Quitter == Quitter
@ -295,6 +466,27 @@ Refreshing master servers
Remote console Remote console
== Console serveur == Console serveur
Remove
== Enlever
Removes collision from this layer
== Enlève la collision depuis cette couche
Removes the image from the map file.
== Enlève l'image de la carte.
Removes the image from the map
== Enlève l'image de la carte
Replace
== Remplacer
Replace Image
== Remplacer l'image
Replaces the image with a new one
== Remplace l'image par une nouvelle
Reset filter Reset filter
== Filtres par défaut == Filtres par défaut
@ -313,6 +505,27 @@ Sample rate
Sat. Sat.
== Sat. == Sat.
Save
== Enregistrer
Save As
== Enregistrer sous
Save map
== Enregistrer la carte
Saves the current map
== Enregistre la carte actuelle
Saves the current map under a new name
== Enregistre la carte actuelle sous un autre nom
Select group. Right click for properties.
== Sélectionner un groupe. Clic-droit pour voir les propriétés.
Select layer. Right click for properties.
== Sélectionner une couche. Clic-droit pour voir les propriétés.
Score Score
== Score == Score
@ -320,7 +533,7 @@ Score board
== Scores == Scores
Score limit Score limit
== Score maxi == Score limite
Scoreboard Scoreboard
== Scores == Scores
@ -328,11 +541,14 @@ Scoreboard
Screenshot Screenshot
== Capture d'écran == Capture d'écran
Select image
== Sélectionner une image
Server details Server details
== Détails du serveur == Détails du serveur
Server info Server info
== Infos. serveur == Info. serveur
Server not full Server not full
== Pas de serveurs pleins == Pas de serveurs pleins
@ -367,12 +583,18 @@ Spectate
Spectators Spectators
== Spectateurs == Spectateurs
Square
== Carré
Standard gametype Standard gametype
== Types de jeu standards == Types de jeu standards
Standard map Standard map
== Cartes standards == Cartes standards
Sudden Death
== Mort Subite
Switch weapon on pickup Switch weapon on pickup
== Sélectionner l'arme ramassée == Sélectionner l'arme ramassée
@ -421,12 +643,18 @@ Vote yes
Voting Voting
== Vote == Vote
Warmup
== Échauffement
Weapon Weapon
== Arme == Arme
Welcome to Teeworlds Welcome to Teeworlds
== Bienvenue dans Teeworlds == Bienvenue dans Teeworlds
Width
== Largeur
Yes Yes
== Oui == Oui
@ -436,53 +664,21 @@ You must restart the game for all settings to take effect.
Your skin Your skin
== Votre skin == Votre skin
ZI
== Z+
ZO
== Z-
##### needs translation #### ##### needs translation ####
Password incorrect
== Password incorrect
Please balance teams!
== Please balance teams!
Connection Problems...
== Connection Problems...
Warmup
== Warmup
Sudden Death
== Sudden Death
%ds left
== %ds left
error loading demo
== error loading demo
Error
== Error
Open map
== Open map
Open
== Open
Save map
== Save map
Save
== Save
HD HD
== HD == HD
[ctrl+h] Toggle High Detail [ctrl+h] Toggle High Detail
== [ctrl+h] Toggle High Detail == [ctrl+h] Toggle High Detail
Anim
== Anim
[ctrl+m] Toggle animation [ctrl+m] Toggle animation
== [ctrl+m] Toggle animation == [ctrl+m] Toggle animation
@ -492,36 +688,9 @@ Proof
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see. [ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
== [ctrl+p] Toggles proof borders. These borders represent what a player maximum can see. == [ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
ZO
== ZO
[NumPad-] Zoom out
== [NumPad-] Zoom out
[NumPad*] Zoom to normal and remove editor offset [NumPad*] Zoom to normal and remove editor offset
== [NumPad*] Zoom to normal and remove editor offset == [NumPad*] Zoom to normal and remove editor offset
ZI
== ZI
[NumPad+] Zoom in
== [NumPad+] Zoom in
Increase animation speed
== Increase animation speed
Normal animation speed
== Normal animation speed
Decrease animation speed
== Decrease animation speed
[N] Flip brush horizontal
== [N] Flip brush horizontal
[M] Flip brush vertical
== [M] Flip brush vertical
CCW CCW
== CCW == CCW
@ -540,9 +709,6 @@ Add Quad
Adds a new quad Adds a new quad
== Adds a new quad == Adds a new quad
Border
== Border
Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate. Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate.
== Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate. == Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate.
@ -555,84 +721,9 @@ Use left mouse button to drag and create a brush.
Use left mouse button to paint with the brush. Right button clears the brush. Use left mouse button to paint with the brush. Right button clears the brush.
== Use left mouse button to paint with the brush. Right button clears the brush. == Use left mouse button to paint with the brush. Right button clears the brush.
Decrease
== Decrease
Increase
== Increase
None
== None
Toggle group visibility Toggle group visibility
== Toggle group visibility == Toggle group visibility
Select group. Right click for properties.
== Select group. Right click for properties.
Add group
== Add group
Adds a new group
== Adds a new group
Embed
== Embed
Embeds the image into the map file.
== Embeds the image into the map file.
Make external
== Make external
Removes the image from the map file.
== Removes the image from the map file.
Replace
== Replace
Replaces the image with a new one
== Replaces the image with a new one
Replace Image
== Replace Image
Remove
== Remove
Removes the image from the map
== Removes the image from the map
Embedded
== Embedded
External
== External
Select image
== Select image
Load a new image to use in the map
== Load a new image to use in the map
Add Image
== Add Image
Add
== Add
Filename:
== Filename:
Cancel
== Cancel
Layers
== Layers
Images
== Images
Switch between images and layers managment. Switch between images and layers managment.
== Switch between images and layers managment. == Switch between images and layers managment.
@ -645,15 +736,9 @@ Toggles the envelope editor.
%s Right click for context menu. %s Right click for context menu.
== %s Right click for context menu. == %s Right click for context menu.
Color+
== Color+
Creates a new color envelope Creates a new color envelope
== Creates a new color envelope == Creates a new color envelope
Pos.+
== Pos.+
Creates a new pos envelope Creates a new pos envelope
== Creates a new pos envelope == Creates a new pos envelope
@ -663,72 +748,12 @@ Previous Envelope
Next Envelope Next Envelope
== Next Envelope == Next Envelope
Name:
== Name:
Press right mouse button to create a new point
== Press right mouse button to create a new point
Switch curve type Switch curve type
== Switch curve type == Switch curve type
Left mouse to drag. Hold shift to alter time point aswell. Right click to delete. Left mouse to drag. Hold shift to alter time point aswell. Right click to delete.
== Left mouse to drag. Hold shift to alter time point aswell. Right click to delete. == Left mouse to drag. Hold shift to alter time point aswell. Right click to delete.
New
== New
Creates a new map
== Creates a new map
Opens a map for editing
== Opens a map for editing
Append
== Append
Opens a map and adds everything from that map to the current one
== Opens a map and adds everything from that map to the current one
Append map
== Append map
Saves the current map
== Saves the current map
Save As
== Save As
Saves the current map under a new name
== Saves the current map under a new name
Exits from the editor
== Exits from the editor
Clear collision
== Clear collision
Removes collision from this layer
== Removes collision from this layer
Make collision
== Make collision
Constructs collision from this layer
== Constructs collision from this layer
Width
== Width
Height
== Height
Image
== Image
Delete group
== Delete group
Add quads layer Add quads layer
== Add quads layer == Add quads layer
@ -741,30 +766,9 @@ Add tile layer
Creates a new tile layer Creates a new tile layer
== Creates a new tile layer == Creates a new tile layer
Delete layer
== Delete Layer
Deletes the layer
== Deletes the layer
Group
== Group
Order
== Order
Detail
== Detail
Delete
== Delete
Deletes the current quad Deletes the current quad
== Deletes the current quad == Deletes the current quad
Square
== Square
Squares the current quad Squares the current quad
== Squares the current quad == Squares the current quad
@ -780,13 +784,7 @@ Color Env
Color TO Color TO
== Color TO == Color TO
Select layer. Right click for properties.
== Select layer. Right click for properties.
Toggle layer visibility Toggle layer visibility
== Toggle layer visibility == Toggle layer visibility
File
== File
##### old translations #### ##### old translations ####

View file

@ -1950,8 +1950,8 @@ void CClient::RegisterCommands()
{ {
m_pConsole = Kernel()->RequestInterface<IConsole>(); m_pConsole = Kernel()->RequestInterface<IConsole>();
// register server dummy commands for tab completion // register server dummy commands for tab completion
m_pConsole->Register("kick", "i", CFGFLAG_SERVER, 0, 0, "Kick player with specified id", 0); m_pConsole->Register("kick", "i?s", CFGFLAG_SERVER, 0, 0, "Kick player with specified id for any reason", 0);
m_pConsole->Register("ban", "s?i", CFGFLAG_SERVER, 0, 0, "Ban player with ip/id for x minutes", 0); m_pConsole->Register("ban", "s?is", CFGFLAG_SERVER, 0, 0, "Ban player with ip/id for x minutes for any reason", 0);
m_pConsole->Register("unban", "s", CFGFLAG_SERVER, 0, 0, "Unban ip", 0); m_pConsole->Register("unban", "s", CFGFLAG_SERVER, 0, 0, "Unban ip", 0);
m_pConsole->Register("bans", "", CFGFLAG_SERVER, 0, 0, "Show banlist", 0); m_pConsole->Register("bans", "", CFGFLAG_SERVER, 0, 0, "Show banlist", 0);
m_pConsole->Register("status", "", CFGFLAG_SERVER, 0, 0, "List players", 0); m_pConsole->Register("status", "", CFGFLAG_SERVER, 0, 0, "List players", 0);

View file

@ -541,6 +541,7 @@ public:
int i; int i;
int GotNewLine = 0; int GotNewLine = 0;
float DrawX, DrawY; float DrawX, DrawY;
int LineCount;
float CursorX, CursorY; float CursorX, CursorY;
const char *pEnd; const char *pEnd;
@ -590,6 +591,7 @@ public:
const char *pEnd = pCurrent+Length; const char *pEnd = pCurrent+Length;
DrawX = CursorX; DrawX = CursorX;
DrawY = CursorY; DrawY = CursorY;
LineCount = pCursor->m_LineCount;
if(pCursor->m_Flags&TEXTFLAG_RENDER) if(pCursor->m_Flags&TEXTFLAG_RENDER)
{ {
@ -607,7 +609,7 @@ public:
Graphics()->SetColor(m_TextR, m_TextG, m_TextB, m_TextA); Graphics()->SetColor(m_TextR, m_TextG, m_TextB, m_TextA);
} }
while(pCurrent < pEnd) while(pCurrent < pEnd && (pCursor->m_MaxLines < 1 || LineCount <= pCursor->m_MaxLines))
{ {
int NewLine = 0; int NewLine = 0;
const char *pBatchEnd = pEnd; const char *pBatchEnd = pEnd;
@ -666,7 +668,9 @@ public:
DrawY += Size; DrawY += Size;
DrawX = (int)(DrawX * FakeToScreenX) / FakeToScreenX; // realign DrawX = (int)(DrawX * FakeToScreenX) / FakeToScreenX; // realign
DrawY = (int)(DrawY * FakeToScreenY) / FakeToScreenY; DrawY = (int)(DrawY * FakeToScreenY) / FakeToScreenY;
++pCursor->m_LineCount; ++LineCount;
if(pCursor->m_MaxLines > 0 && LineCount > pCursor->m_MaxLines)
break;
continue; continue;
} }
@ -702,7 +706,7 @@ public:
GotNewLine = 1; GotNewLine = 1;
DrawX = (int)(DrawX * FakeToScreenX) / FakeToScreenX; // realign DrawX = (int)(DrawX * FakeToScreenX) / FakeToScreenX; // realign
DrawY = (int)(DrawY * FakeToScreenY) / FakeToScreenY; DrawY = (int)(DrawY * FakeToScreenY) / FakeToScreenY;
++pCursor->m_LineCount; ++LineCount;
} }
} }
@ -711,6 +715,7 @@ public:
} }
pCursor->m_X = DrawX; pCursor->m_X = DrawX;
pCursor->m_LineCount = LineCount;
if(GotNewLine) if(GotNewLine)
pCursor->m_Y = DrawY; pCursor->m_Y = DrawY;

View file

@ -661,7 +661,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
{ {
// OH FUCK! wrong version, drop him // OH FUCK! wrong version, drop him
char aReason[256]; char aReason[256];
str_format(aReason, sizeof(aReason), "wrong version. server is running '%s' and client '%s'.", GameServer()->NetVersion(), aVersion); str_format(aReason, sizeof(aReason), "Wrong version. Server is running '%s' and client '%s'", GameServer()->NetVersion(), aVersion);
m_NetServer.Drop(ClientId, aReason); m_NetServer.Drop(ClientId, aReason);
return; return;
} }
@ -673,7 +673,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
if(g_Config.m_Password[0] != 0 && str_comp(g_Config.m_Password, pPassword) != 0) if(g_Config.m_Password[0] != 0 && str_comp(g_Config.m_Password, pPassword) != 0)
{ {
// wrong password // wrong password
m_NetServer.Drop(ClientId, "wrong password"); m_NetServer.Drop(ClientId, "Wrong password");
return; return;
} }
@ -881,7 +881,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
else else
{ {
NETADDR Addr = m_NetServer.ClientAddr(ClientId); NETADDR Addr = m_NetServer.ClientAddr(ClientId);
BanAdd(Addr, g_Config.m_SvRconBantime*60); BanAdd(Addr, g_Config.m_SvRconBantime*60, "Too many remote console authentication tries");
} }
} }
} }
@ -1005,7 +1005,7 @@ void CServer::UpdateServerInfo()
} }
} }
int CServer::BanAdd(NETADDR Addr, int Seconds) int CServer::BanAdd(NETADDR Addr, int Seconds, const char *pReason)
{ {
Addr.port = 0; Addr.port = 0;
char aAddrStr[128]; char aAddrStr[128];
@ -1017,7 +1017,7 @@ int CServer::BanAdd(NETADDR Addr, int Seconds)
str_format(aBuf, sizeof(aBuf), "banned %s for life", aAddrStr); str_format(aBuf, sizeof(aBuf), "banned %s for life", aAddrStr);
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf); Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
return m_NetServer.BanAdd(Addr, Seconds); return m_NetServer.BanAdd(Addr, Seconds, pReason);
} }
int CServer::BanRemove(NETADDR Addr) int CServer::BanRemove(NETADDR Addr)
@ -1304,7 +1304,7 @@ int CServer::Run()
for(int i = 0; i < MAX_CLIENTS; ++i) for(int i = 0; i < MAX_CLIENTS; ++i)
{ {
if(m_aClients[i].m_State != CClient::STATE_EMPTY) if(m_aClients[i].m_State != CClient::STATE_EMPTY)
m_NetServer.Drop(i, "server shutdown"); m_NetServer.Drop(i, "Server shutdown");
} }
GameServer()->OnShutdown(); GameServer()->OnShutdown();
@ -1317,7 +1317,14 @@ int CServer::Run()
void CServer::ConKick(IConsole::IResult *pResult, void *pUser, int ClientId) void CServer::ConKick(IConsole::IResult *pResult, void *pUser, int ClientId)
{ {
((CServer *)pUser)->Kick(pResult->GetInteger(0), "kicked by console"); if(pResult->NumArguments() > 1)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "Kicked by console (%s)", pResult->GetString(1));
((CServer *)pUser)->Kick(pResult->GetInteger(0), aBuf);
}
else
((CServer *)pUser)->Kick(pResult->GetInteger(0), "Kicked by console");
} }
void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1) void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1)
@ -1326,10 +1333,14 @@ void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1)
CServer *pServer = (CServer *)pUser; CServer *pServer = (CServer *)pUser;
const char *pStr = pResult->GetString(0); const char *pStr = pResult->GetString(0);
int Minutes = 30; int Minutes = 30;
const char *pReason = "No reason given";
if(pResult->NumArguments() > 1) if(pResult->NumArguments() > 1)
Minutes = pResult->GetInteger(1); Minutes = pResult->GetInteger(1);
if(pResult->NumArguments() > 2)
pReason = pResult->GetString(2);
if(net_addr_from_str(&Addr, pStr) == 0) if(net_addr_from_str(&Addr, pStr) == 0)
{ {
if(pServer->m_RconClientId >= 0 && pServer->m_RconClientId < MAX_CLIENTS && pServer->m_aClients[pServer->m_RconClientId].m_State != CClient::STATE_EMPTY) if(pServer->m_RconClientId >= 0 && pServer->m_RconClientId < MAX_CLIENTS && pServer->m_aClients[pServer->m_RconClientId].m_State != CClient::STATE_EMPTY)
@ -1342,7 +1353,7 @@ void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1)
return; return;
} }
} }
pServer->BanAdd(Addr, Minutes*60); pServer->BanAdd(Addr, Minutes*60, pReason);
} }
else if(StrAllnum(pStr)) else if(StrAllnum(pStr))
{ {
@ -1360,7 +1371,7 @@ void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1)
} }
Addr = pServer->m_NetServer.ClientAddr(ClientId); Addr = pServer->m_NetServer.ClientAddr(ClientId);
pServer->BanAdd(Addr, Minutes*60); pServer->BanAdd(Addr, Minutes*60, pReason);
} }
else else
{ {
@ -1495,8 +1506,8 @@ void CServer::RegisterCommands()
{ {
m_pConsole = Kernel()->RequestInterface<IConsole>(); m_pConsole = Kernel()->RequestInterface<IConsole>();
Console()->Register("kick", "i", CFGFLAG_SERVER, ConKick, this, "", 2); Console()->Register("kick", "i?s", CFGFLAG_SERVER, ConKick, this, "", 2);
Console()->Register("ban", "s?i", CFGFLAG_SERVER|CFGFLAG_STORE, ConBan, this, "", 2); Console()->Register("ban", "s?is", CFGFLAG_SERVER|CFGFLAG_STORE, ConBan, this, "", 2);
Console()->Register("unban", "s", CFGFLAG_SERVER|CFGFLAG_STORE, ConUnban, this, "", 2); Console()->Register("unban", "s", CFGFLAG_SERVER|CFGFLAG_STORE, ConUnban, this, "", 2);
Console()->Register("bans", "", CFGFLAG_SERVER|CFGFLAG_STORE, ConBans, this, "", 2); Console()->Register("bans", "", CFGFLAG_SERVER|CFGFLAG_STORE, ConBans, this, "", 2);
Console()->Register("status", "", CFGFLAG_SERVER, ConStatus, this, "", 1); Console()->Register("status", "", CFGFLAG_SERVER, ConStatus, this, "", 1);
@ -1707,7 +1718,7 @@ void CServer::CheckPass(int ClientId, const char *pPw)
else else
{ {
NETADDR Addr = m_NetServer.ClientAddr(ClientId); NETADDR Addr = m_NetServer.ClientAddr(ClientId);
BanAdd(Addr, g_Config.m_SvRconBantime); BanAdd(Addr, g_Config.m_SvRconBantime, "Too many remote console authentication tries");
} }
} }
} }
@ -1732,6 +1743,6 @@ void CServer::CheckPass(int ClientId, const char *pPw)
ClientId, ClientId,
m_aClients[ClientId].m_Addr.ip[0], m_aClients[ClientId].m_Addr.ip[1], m_aClients[ClientId].m_Addr.ip[2], m_aClients[ClientId].m_Addr.ip[3] m_aClients[ClientId].m_Addr.ip[0], m_aClients[ClientId].m_Addr.ip[1], m_aClients[ClientId].m_Addr.ip[2], m_aClients[ClientId].m_Addr.ip[3]
); );
BanAdd(m_aClients[ClientId].m_Addr, 0); BanAdd(m_aClients[ClientId].m_Addr, 0, "Being a noob");
} }
} }

View file

@ -183,7 +183,7 @@ public:
void SendServerInfo(NETADDR *pAddr, int Token); void SendServerInfo(NETADDR *pAddr, int Token);
void UpdateServerInfo(); void UpdateServerInfo();
int BanAdd(NETADDR Addr, int Seconds); int BanAdd(NETADDR Addr, int Seconds, const char *pReason);
int BanRemove(NETADDR Addr); int BanRemove(NETADDR Addr);

View file

@ -272,10 +272,10 @@ public:
int Update(); int Update();
// //
int Drop(int ClientID, const char *Reason); int Drop(int ClientID, const char *pReason);
// banning // banning
int BanAdd(NETADDR Addr, int Seconds); int BanAdd(NETADDR Addr, int Seconds, const char *pReason);
int BanRemove(NETADDR Addr); int BanRemove(NETADDR Addr);
int BanNum(); // caution, slow int BanNum(); // caution, slow
int BanGet(int Index, CBanInfo *pInfo); // caution, slow int BanGet(int Index, CBanInfo *pInfo); // caution, slow

View file

@ -226,7 +226,7 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
SetError(Str); SetError(Str);
} }
else else
SetError("no reason given"); SetError("No reason given");
if(g_Config.m_Debug) if(g_Config.m_Debug)
dbg_msg("conn", "closed reason='%s'", ErrorString()); dbg_msg("conn", "closed reason='%s'", ErrorString());
@ -304,7 +304,7 @@ int CNetConnection::Update()
(Now-m_LastRecvTime) > time_freq()*10) (Now-m_LastRecvTime) > time_freq()*10)
{ {
m_State = NET_CONNSTATE_ERROR; m_State = NET_CONNSTATE_ERROR;
SetError("timeout"); SetError("Timeout");
} }
// fix resends // fix resends
@ -316,7 +316,7 @@ int CNetConnection::Update()
if(Now-pResend->m_FirstSendTime > time_freq()*10) if(Now-pResend->m_FirstSendTime > time_freq()*10)
{ {
m_State = NET_CONNSTATE_ERROR; m_State = NET_CONNSTATE_ERROR;
SetError("too weak connection (not acked for 10 seconds)"); SetError("Too weak connection (not acked for 10 seconds)");
} }
else else
{ {

View file

@ -139,7 +139,7 @@ int CNetServer::BanRemove(NETADDR Addr)
return -1; return -1;
} }
int CNetServer::BanAdd(NETADDR Addr, int Seconds) int CNetServer::BanAdd(NETADDR Addr, int Seconds, const char *pReason)
{ {
int IpHash = (Addr.ip[0]+Addr.ip[1]+Addr.ip[2]+Addr.ip[3])&0xff; int IpHash = (Addr.ip[0]+Addr.ip[1]+Addr.ip[2]+Addr.ip[3])&0xff;
int Stamp = -1; int Stamp = -1;
@ -213,9 +213,9 @@ int CNetServer::BanAdd(NETADDR Addr, int Seconds)
NETADDR BanAddr; NETADDR BanAddr;
if(Seconds) if(Seconds)
str_format(Buf, sizeof(Buf), "you have been banned for %d minutes", Seconds/60); str_format(Buf, sizeof(Buf), "You have been banned for %d minutes (%s)", Seconds/60, pReason);
else else
str_format(Buf, sizeof(Buf), "you have been banned for life"); str_format(Buf, sizeof(Buf), "You have been banned for life (%s)", pReason);
for(int i = 0; i < MaxClients(); i++) for(int i = 0; i < MaxClients(); i++)
{ {
@ -295,12 +295,12 @@ int CNetServer::Recv(CNetChunk *pChunk)
{ {
int Mins = ((pBan->m_Info.m_Expires - Now)+59)/60; int Mins = ((pBan->m_Info.m_Expires - Now)+59)/60;
if(Mins == 1) if(Mins == 1)
str_format(BanStr, sizeof(BanStr), "banned for %d minute", Mins); str_format(BanStr, sizeof(BanStr), "Banned for 1 minute");
else else
str_format(BanStr, sizeof(BanStr), "banned for %d minutes", Mins); str_format(BanStr, sizeof(BanStr), "Banned for %d minutes", Mins);
} }
else else
str_format(BanStr, sizeof(BanStr), "banned for life"); str_format(BanStr, sizeof(BanStr), "Banned for life");
CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, BanStr, str_length(BanStr)+1); CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, BanStr, str_length(BanStr)+1);
continue; continue;
} }
@ -352,7 +352,7 @@ int CNetServer::Recv(CNetChunk *pChunk)
if(FoundAddr++ >= m_MaxClientsPerIP) if(FoundAddr++ >= m_MaxClientsPerIP)
{ {
char aBuf[128]; char aBuf[128];
str_format(aBuf, sizeof(aBuf), "only %i players with same ip allowed", m_MaxClientsPerIP); str_format(aBuf, sizeof(aBuf), "Only %d players with the same IP are allowed", m_MaxClientsPerIP);
CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, aBuf, sizeof(aBuf)); CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, aBuf, sizeof(aBuf));
return 0; return 0;
} }
@ -373,7 +373,7 @@ int CNetServer::Recv(CNetChunk *pChunk)
if(!Found) if(!Found)
{ {
const char FullMsg[] = "server is full"; const char FullMsg[] = "This server is full";
CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, FullMsg, sizeof(FullMsg)); CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, FullMsg, sizeof(FullMsg));
} }
} }
@ -429,7 +429,7 @@ int CNetServer::Send(CNetChunk *pChunk)
} }
else else
{ {
Drop(pChunk->m_ClientID, "error sending data"); Drop(pChunk->m_ClientID, "Error sending data");
} }
} }
return 0; return 0;

View file

@ -17,6 +17,7 @@ public:
int m_Flags; int m_Flags;
int m_LineCount; int m_LineCount;
int m_CharCount; int m_CharCount;
int m_MaxLines;
float m_StartX; float m_StartX;
float m_StartY; float m_StartY;

View file

@ -31,6 +31,8 @@ void CChat::OnReset()
} }
m_Show = false; m_Show = false;
m_InputUpdate = false;
m_ChatStringOffset = 0;
} }
void CChat::OnRelease() void CChat::OnRelease()
@ -101,7 +103,10 @@ bool CChat::OnInput(IInput::CEvent e)
m_pClient->OnRelease(); m_pClient->OnRelease();
} }
else else
{
m_Input.ProcessInput(e); m_Input.ProcessInput(e);
m_InputUpdate = true;
}
return true; return true;
} }
@ -203,6 +208,7 @@ void CChat::OnRender()
CTextCursor Cursor; CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, x, y, 8.0f, TEXTFLAG_RENDER); TextRender()->SetCursor(&Cursor, x, y, 8.0f, TEXTFLAG_RENDER);
Cursor.m_LineWidth = 200.0f; Cursor.m_LineWidth = 200.0f;
Cursor.m_MaxLines = 2;
if(m_Mode == MODE_ALL) if(m_Mode == MODE_ALL)
TextRender()->TextEx(&Cursor, Localize("All"), -1); TextRender()->TextEx(&Cursor, Localize("All"), -1);
@ -213,7 +219,23 @@ void CChat::OnRender()
TextRender()->TextEx(&Cursor, ": ", -1); TextRender()->TextEx(&Cursor, ": ", -1);
TextRender()->TextEx(&Cursor, m_Input.GetString(), m_Input.GetCursorOffset()); // check if the visible text has to be moved
if(m_InputUpdate)
{
if(m_ChatStringOffset > m_Input.GetCursorOffset())
--m_ChatStringOffset;
else
{
CTextCursor Temp = Cursor;
Temp.m_Flags = 0;
TextRender()->TextEx(&Temp, m_Input.GetString()+m_ChatStringOffset, m_Input.GetCursorOffset()-m_ChatStringOffset);
TextRender()->TextEx(&Temp, "|", -1);
if(Temp.m_LineCount > 2)
++m_ChatStringOffset;
}
}
TextRender()->TextEx(&Cursor, m_Input.GetString()+m_ChatStringOffset, m_Input.GetCursorOffset()-m_ChatStringOffset);
CTextCursor Marker = Cursor; CTextCursor Marker = Cursor;
TextRender()->TextEx(&Marker, "|", -1); TextRender()->TextEx(&Marker, "|", -1);
TextRender()->TextEx(&Cursor, m_Input.GetString()+m_Input.GetCursorOffset(), -1); TextRender()->TextEx(&Cursor, m_Input.GetString()+m_Input.GetCursorOffset(), -1);

View file

@ -35,6 +35,8 @@ class CChat : public CComponent
int m_Mode; int m_Mode;
bool m_Show; bool m_Show;
bool m_InputUpdate;
int m_ChatStringOffset;
static void ConSay(IConsole::IResult *pResult, void *pUserData, int ClientID); static void ConSay(IConsole::IResult *pResult, void *pUserData, int ClientID);
static void ConSayTeam(IConsole::IResult *pResult, void *pUserData, int ClientID); static void ConSayTeam(IConsole::IResult *pResult, void *pUserData, int ClientID);

View file

@ -1,4 +1,3 @@
//#include "gc_console.h"
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
@ -38,10 +37,6 @@ enum
CGameConsole::CInstance::CInstance(int Type) CGameConsole::CInstance::CInstance(int Type)
{ {
// init ringbuffers
//history = ringbuf_init(history_data, sizeof(history_data), RINGBUF_FLAG_RECYCLE);
//backlog = ringbuf_init(backlog_data, sizeof(backlog_data), RINGBUF_FLAG_RECYCLE);
m_pHistoryEntry = 0x0; m_pHistoryEntry = 0x0;
m_Type = Type; m_Type = Type;
@ -69,6 +64,12 @@ void CGameConsole::CInstance::ClearBacklog()
m_BacklogActPage = 0; m_BacklogActPage = 0;
} }
void CGameConsole::CInstance::ClearHistory()
{
m_History.Init();
m_pHistoryEntry = 0;
}
void CGameConsole::CInstance::ExecuteLine(const char *pLine) void CGameConsole::CInstance::ExecuteLine(const char *pLine)
{ {
if(m_Type == 0) if(m_Type == 0)
@ -100,8 +101,11 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
{ {
if(m_Input.GetString()[0]) if(m_Input.GetString()[0])
{ {
char *pEntry = m_History.Allocate(m_Input.GetLength()+1); if(m_Type != 1 || m_pGameConsole->Client()->RconAuthed())
mem_copy(pEntry, m_Input.GetString(), m_Input.GetLength()+1); {
char *pEntry = m_History.Allocate(m_Input.GetLength()+1);
mem_copy(pEntry, m_Input.GetString(), m_Input.GetLength()+1);
}
ExecuteLine(m_Input.GetString()); ExecuteLine(m_Input.GetString());
m_Input.Clear(); m_Input.Clear();
m_pHistoryEntry = 0x0; m_pHistoryEntry = 0x0;
@ -670,34 +674,8 @@ void CGameConsole::OnConsoleInit()
Console()->Register("dump_remote_console", "", CFGFLAG_CLIENT, ConDumpRemoteConsole, this, "Dump remote console", 0); Console()->Register("dump_remote_console", "", CFGFLAG_CLIENT, ConDumpRemoteConsole, this, "Dump remote console", 0);
} }
/* void CGameConsole::OnStateChange(int NewState, int OldState)
static void con_team(void *result, void *user_data)
{ {
send_switch_team(console_arg_int(result, 0)); if(NewState == IClient::STATE_OFFLINE)
m_RemoteConsole.ClearHistory();
} }
static void con_kill(void *result, void *user_data)
{
send_kill(-1);
}
void send_kill(int client_id);
static void con_emote(void *result, void *user_data)
{
send_emoticon(console_arg_int(result, 0));
}
extern void con_chat(void *result, void *user_data);
void client_console_init()
{
//
MACRO_REGISTER_COMMAND("team", "i", con_team, 0x0);
MACRO_REGISTER_COMMAND("kill", "", con_kill, 0x0);
// chatting
MACRO_REGISTER_COMMAND("emote", "i", con_emote, 0);
MACRO_REGISTER_COMMAND("+emote", "", con_key_input_state, &emoticon_selector_active);
}
*/

View file

@ -32,6 +32,7 @@ class CGameConsole : public CComponent
void Init(CGameConsole *pGameConsole); void Init(CGameConsole *pGameConsole);
void ClearBacklog(); void ClearBacklog();
void ClearHistory();
void ExecuteLine(const char *pLine); void ExecuteLine(const char *pLine);
@ -72,6 +73,7 @@ public:
void PrintLine(int Type, const char *pLine); void PrintLine(int Type, const char *pLine);
virtual void OnStateChange(int NewState, int OldState);
virtual void OnConsoleInit(); virtual void OnConsoleInit();
virtual void OnReset(); virtual void OnReset();
virtual void OnRender(); virtual void OnRender();

View file

@ -99,6 +99,7 @@ CMenus::CMenus()
m_LastInput = time_get(); m_LastInput = time_get();
str_copy(m_aCurrentDemoFolder, "demos", sizeof(m_aCurrentDemoFolder)); str_copy(m_aCurrentDemoFolder, "demos", sizeof(m_aCurrentDemoFolder));
m_aCallvoteReason[0] = 0;
} }
vec4 CMenus::ButtonColorMul(const void *pID) vec4 CMenus::ButtonColorMul(const void *pID)
@ -219,7 +220,10 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
{ {
int Inside = UI()->MouseInside(pRect); int Inside = UI()->MouseInside(pRect);
bool ReturnValue = false; bool ReturnValue = false;
bool UpdateOffset = false;
static int s_AtIndex = 0; static int s_AtIndex = 0;
static bool s_DoScroll = false;
static float s_ScrollStart = 0.0f;
if(UI()->LastActiveItem() == pID) if(UI()->LastActiveItem() == pID)
{ {
@ -229,6 +233,8 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
if(Inside && UI()->MouseButton(0)) if(Inside && UI()->MouseButton(0))
{ {
s_DoScroll = true;
s_ScrollStart = UI()->MouseX();
int MxRel = (int)(UI()->MouseX() - pRect->x); int MxRel = (int)(UI()->MouseX() - pRect->x);
for(int i = 1; i <= Len; i++) for(int i = 1; i <= Len; i++)
@ -243,6 +249,24 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
s_AtIndex = Len; s_AtIndex = Len;
} }
} }
else if(!UI()->MouseButton(0))
s_DoScroll = false;
else if(s_DoScroll)
{
// do scrolling
if(UI()->MouseX() < pRect->x && s_ScrollStart-UI()->MouseX() > 10.0f)
{
s_AtIndex = max(0, s_AtIndex-1);
s_ScrollStart = UI()->MouseX();
UpdateOffset = true;
}
else if(UI()->MouseX() > pRect->x+pRect->w && UI()->MouseX()-s_ScrollStart > 10.0f)
{
s_AtIndex = min(Len, s_AtIndex+1);
s_ScrollStart = UI()->MouseX();
UpdateOffset = true;
}
}
for(int i = 0; i < m_NumInputEvents; i++) for(int i = 0; i < m_NumInputEvents; i++)
{ {
@ -256,7 +280,10 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
if(UI()->ActiveItem() == pID) if(UI()->ActiveItem() == pID)
{ {
if(!UI()->MouseButton(0)) if(!UI()->MouseButton(0))
{
s_DoScroll = false;
UI()->SetActiveItem(0); UI()->SetActiveItem(0);
}
} }
else if(UI()->HotItem() == pID) else if(UI()->HotItem() == pID)
{ {
@ -291,7 +318,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
} }
// check if the text has to be moved // check if the text has to be moved
if(UI()->LastActiveItem() == pID && !JustGotActive && m_NumInputEvents) if(UI()->LastActiveItem() == pID && !JustGotActive && (UpdateOffset || m_NumInputEvents))
{ {
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex)*UI()->Scale(); float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex)*UI()->Scale();
if(w-*Offset > Textbox.w) if(w-*Offset > Textbox.w)

View file

@ -152,6 +152,7 @@ class CMenus : public CComponent
// for call vote // for call vote
int m_CallvoteSelectedOption; int m_CallvoteSelectedOption;
int m_CallvoteSelectedPlayer; int m_CallvoteSelectedPlayer;
char m_aCallvoteReason[16];
// demo // demo
struct CDemoItem struct CDemoItem

View file

@ -414,12 +414,28 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS && if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer]) m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
{ {
m_pClient->m_pVoting->CallvoteKick(m_CallvoteSelectedPlayer); m_pClient->m_pVoting->CallvoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason);
m_aCallvoteReason[0] = 0;
SetActive(false); SetActive(false);
} }
} }
} }
// render kick reason
if(s_ControlPage == 1)
{
CUIRect Reason;
Bottom.VSplitRight(40.0f, &Bottom, 0);
Bottom.VSplitRight(160.0f, &Bottom, &Reason);
Reason.HSplitTop(5.0f, 0, &Reason);
const char *pLabel = Localize("Reason:");
UI()->DoLabel(&Reason, pLabel, 14.0f, -1);
float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1);
Reason.VSplitLeft(w+10.0f, 0, &Reason);
static float s_Offset = 0.0f;
DoEditBox(&m_aCallvoteReason, &Reason, m_aCallvoteReason, sizeof(m_aCallvoteReason), 14.0f, &s_Offset, false, CUI::CORNER_ALL);
}
// force vote button (only available when authed in rcon) // force vote button (only available when authed in rcon)
if(Client()->RconAuthed()) if(Client()->RconAuthed())
{ {
@ -437,7 +453,8 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS && if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer]) m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
{ {
m_pClient->m_pVoting->ForcevoteKick(m_CallvoteSelectedPlayer); m_pClient->m_pVoting->ForcevoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason);
m_aCallvoteReason[0] = 0;
SetActive(false); SetActive(false);
} }
} }

View file

@ -296,7 +296,7 @@ void CScoreboard::RenderRecordingNotification(float x)
Graphics()->QuadsEnd(); Graphics()->QuadsEnd();
//draw the text //draw the text
TextRender()->Text(0, x+50.0f, 8.0f, 24.0f, "REC", -1); TextRender()->Text(0, x+50.0f, 8.0f, 24.0f, Localize("REC"), -1);
} }
void CScoreboard::OnRender() void CScoreboard::OnRender()

View file

@ -29,11 +29,14 @@ void CVoting::Callvote(const char *pType, const char *pValue)
Client()->SendPackMsg(&Msg, MSGFLAG_VITAL); Client()->SendPackMsg(&Msg, MSGFLAG_VITAL);
} }
void CVoting::CallvoteKick(int ClientId) void CVoting::CallvoteKick(int ClientId, const char *pReason)
{ {
char Buf[32]; char aBuf[32];
str_format(Buf, sizeof(Buf), "%d", ClientId); if(pReason[0])
Callvote("kick", Buf); str_format(aBuf, sizeof(aBuf), "%d %s", ClientId, pReason);
else
str_format(aBuf, sizeof(aBuf), "%d", ClientId);
Callvote("kick", aBuf);
} }
void CVoting::CallvoteOption(int OptionId) void CVoting::CallvoteOption(int OptionId)
@ -52,11 +55,14 @@ void CVoting::CallvoteOption(int OptionId)
} }
} }
void CVoting::ForcevoteKick(int ClientId) void CVoting::ForcevoteKick(int ClientId, const char *pReason)
{ {
char Buf[32]; char aBuf[32];
str_format(Buf, sizeof(Buf), "kick %d", ClientId); if(pReason[0])
Client()->Rcon(Buf); str_format(aBuf, sizeof(aBuf), "kick %d \"%s\"", ClientId, pReason);
else
str_format(aBuf, sizeof(aBuf), "kick %d", ClientId);
Client()->Rcon(aBuf);
} }
void CVoting::ForcevoteOption(int OptionId) void CVoting::ForcevoteOption(int OptionId)

View file

@ -39,9 +39,9 @@ public:
void RenderBars(CUIRect Bars, bool Text); void RenderBars(CUIRect Bars, bool Text);
void CallvoteKick(int ClientId); void CallvoteKick(int ClientId, const char *pReason);
void CallvoteOption(int Option); void CallvoteOption(int Option);
void ForcevoteKick(int ClientId); void ForcevoteKick(int ClientId, const char *pReason);
void ForcevoteOption(int Option); void ForcevoteOption(int Option);
void Vote(int v); // -1 = no, 1 = yes void Vote(int v); // -1 = no, 1 = yes

View file

@ -2202,7 +2202,7 @@ static void EditorListdirCallback(const char *pName, int IsDir, int StorageType,
void CEditor::AddFileDialogEntry(int Index, CUIRect *pView) void CEditor::AddFileDialogEntry(int Index, CUIRect *pView)
{ {
m_FilesCur++; m_FilesCur++;
if(m_FilesCur-1 < m_FilesStartAt || m_FilesCur > m_FilesStopAt) if(m_FilesCur-1 < m_FilesStartAt || m_FilesCur >= m_FilesStopAt)
return; return;
CUIRect Button; CUIRect Button;

View file

@ -853,15 +853,25 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
m_apPlayers[ClientId]->m_Last_KickVote = time_get(); m_apPlayers[ClientId]->m_Last_KickVote = time_get();
return; return;
} }
str_format(aChatmsg, sizeof(aChatmsg), "'%s' called for vote to kick '%s'", Server()->ClientName(ClientId), Server()->ClientName(KickId)); const char *pReason = "No reason given";
for(const char *p = pMsg->m_Value; *p; ++p)
{
if(*p == ' ')
{
pReason = p+1;
break;
}
}
str_format(aChatmsg, sizeof(aChatmsg), "'%s' called for vote to kick '%s' (%s)", Server()->ClientName(ClientId), Server()->ClientName(KickId), pReason);
str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickId)); str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickId));
if(!g_Config.m_SvVoteKickBantime) if(!g_Config.m_SvVoteKickBantime)
str_format(aCmd, sizeof(aCmd), "kick %d", KickId); str_format(aCmd, sizeof(aCmd), "kick %d \"Kicked by vote\"", KickId);
else else
{ {
char aBuf[64] = {0}; char aBuf[64] = {0};
Server()->GetClientIP(KickId, aBuf, sizeof(aBuf)); Server()->GetClientIP(KickId, aBuf, sizeof(aBuf));
str_format(aCmd, sizeof(aCmd), "ban %s %d", aBuf, g_Config.m_SvVoteKickBantime); str_format(aCmd, sizeof(aCmd), "ban %s %d \"Banned by vote\"", aBuf, g_Config.m_SvVoteKickBantime);
} }
m_apPlayers[ClientId]->m_Last_KickVote = time_get(); m_apPlayers[ClientId]->m_Last_KickVote = time_get();
m_VoteKick = true; m_VoteKick = true;