Nigga
Administrator
Dołączył: 18 Mar 2008
Posty: 43
Przeczytał: 0 tematów
Ostrzeżeń: 0/5
|
Wysłany: Wto 14:06, 25 Mar 2008 Temat postu: [CODE] /lock |
|
|
Este code hace que si un gm escriba /lock Player, lo encierre en un determinado mapa, por 5 minutos.
Sources HG, Game.CPP, buscan /who y agregan abajo:
Kod: |
if (memcmp(cp, "/lock ", 6) == 0)
{
char seps[] = "= \t\n";
class CStrTok * pStrTok;
char * token;
pStrTok = new CStrTok(cBuffer, seps);
token = pStrTok->pGet();
token = pStrTok->pGet();
if ((pCliH->m_iAdminUserLevel & H_GM_COMMANDS) && (token != NULL))
{
for (int i = 0; i < DEF_MAXCLIENTS; i++)
{
if (m_pClientList[i] != NULL && strcmp(token, m_pClientList[i]->m_cCharName) == 0)
{
int time = 0;
char cName[11];
strcpy(cName, token);
token = pStrTok->pGet();
if (token == NULL)
{
char cGMName[11];
if (m_pClientList[i]->m_cGMLocked != NULL) memcpy(cGMName, m_pClientList[i]->m_cGMLocked, 10);
else memcpy(cGMName, "Unknown", 7);
if (m_pClientList[i]->m_iLockedMapTime > 0)
wsprintf(G_cTxt, "%s is locked to %s map for %d minutes. Forced by %s.", cName, m_pClientList[i]->m_cLockedMapName,
((m_pClientList[i]->m_iLockedMapTime+59)/60), cGMName);
else
wsprintf(G_cTxt, "%s isn't locked to any map.", cName);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, G_cTxt);
delete pStrTok;
return;
}
else
{
ZeroMemory(m_pClientList[i]->m_cLockedMapName, sizeof(m_pClientList[i]->m_cLockedMapName));
if (H_IsThisMapExist(token))
{
strcpy(m_pClientList[i]->m_cLockedMapName, token);
token = pStrTok->pGet();
if (token != NULL)
time = atoi(token)*60;
else time = 5 * 60;
}
else
{
time = atoi(token)*60;
strcpy(m_pClientList[i]->m_cLockedMapName, pCliH->m_cMapName);
}
if (time <= 0)
{
ZeroMemory(m_pClientList[i]->m_cLockedMapName, sizeof(m_pClientList[i]->m_cLockedMapName));
strcpy(m_pClientList[i]->m_cLockedMapName, "NONE");
time = 0;
}
m_pClientList[i]->m_iLockedMapTime = time;
strcpy(m_pClientList[i]->m_cGMLocked, pCliH->m_cCharName);
wsprintf(G_cTxt,"Character %s is locked to %s map for %d minutes.",
cName, m_pClientList[i]->m_cLockedMapName, ((time+59)/60));
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, 0, 0, 0, G_cTxt);
SendNotifyMsg(NULL, i, DEF_NOTIFY_NOTICEMSG, 0, 0, 0, G_cTxt);
if (time > 0)
{
char bufor [100];
strcpy(bufor, m_pClientList[i]->m_cLockedMapName);
RequestTeleportHandler(i, "2 ", bufor);
}
delete pStrTok;
return;
}
}
}
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_PLAYERNOTONGAME, NULL, NULL, NULL, token);
}
else // User level
{
if (pCliH->m_iLockedMapTime > 0)
wsprintf(G_cTxt,"You are locked to %s map for %d minutes.", pCliH->m_cLockedMapName, ((pCliH->m_iLockedMapTime+30)/60));
else
wsprintf(G_cTxt, "You aren't locked to any map.");
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, G_cTxt);
}
delete pStrTok;
return;
} |
Post został pochwalony 0 razy
|
|