Lieber Besucher, herzlich willkommen bei: sourceserver.info. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.
Quellcode |
|
1 |
CreateTimer(restart_delay, Balance, (teamT, teamCT)); |
Quellcode |
|
1 |
public Action:Balance(Handle:timer, any:teamT, any:teamCT) |
Quellcode |
|
1 |
CreateTimer(30.0, restart_delay, Balance, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); |
Quellcode |
|
1 2 3 4 5 6 7 8 9 |
for (new i=1; i<g_diff; i++) { do { client = GetRandomInt(1, MaxClients); g_players[i] = client; } while(!IsClientInGame(client) || GetClientTeam(client) != TS); } |
Quellcode |
|
1 2 3 4 5 6 7 8 9 |
new AdminId:adminid; for (new i = 1; i <= MaxClients; i++) { adminid = GetUserAdmin(i); if ((IsClientInGame(i) && (GetClientTeam(i) == TS)) && !(GetAdminFlag(adminid, Admin_Kick))) { PushArrayCell(g_adtClientlist, i); } } |
Quellcode |
|
1 2 3 4 5 6 7 |
for (new i = 1; i <= MaxClients; i++) { if (IsClientInGame(i) && IsClientConnected(i) && (GetClientTeam(i) == TS) && (GetUserAdmin(i) == INVALID_ADMIN_ID)) { PushArrayCell(g_adtClientlist, i); } } |
PHP-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
new Handle:g_cvar_checkinterval;
new Handle:g_roundend_counter;
public OnPluginStart()
{
g_cvar_checkinterval = CreateConVar("sm_checkinterval", "1.0", "team balance after x rounds", 0, true, 1.0);
HookEvent("round_end", Event_RoundEnd)
g_Cvar_round_restart_delay = FindConVar("mp_round_restart_delay");
}
public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
new Float:restart_delay = GetConVarFloat(g_Cvar_round_restart_delay);
g_roundend_counter++;
if (g_cvar_checkinterval == g_roundend_counter)
{
CreateTimer((restart_delay-0.1), Balance);
g_roundend_counter = 0; (<---- tag mismatch Zeile)
}
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Mathmos« (20. Juli 2011, 21:42)
PHP-Quelltext |
|
1 |
if( ( ( inGameOnly ) ? IsClientInGame( i ) : IsClientConnected( i ) ) && !IsFakeClient( i ) )
|
Kathy hat in einem andern Thread folgende Codezeile verwendet.
PHP-Quelltext
1if( ( ( inGameOnly ) ? IsClientInGame( i ) : IsClientConnected( i ) ) && !IsFakeClient( i ) )
Nun würde ich mal gerne wissen, was das mit dem Fragezeichen und dem Doppelpunkt auf sich hat.
&& und || ist mir bekannt, aber die andern beiden Operatoren leider nicht.
Habs mittlerweile schon des Öfteren gesehen, aber leider konnte ich mir da keinen Reim drauf bilden.
PHP-Quelltext |
|
1 |
(count ($links) > 1) ? ($links = join (" | ",$links)) : ($links = "");
|
PHP-Quelltext |
|
1 2 3 4 5 6 |
if (count ($links) > 1)
{
$links = join (" | ",$links);
} else {
$links = "";
}
|
PHP-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
#include <sourcemod>
#include <cstrike>
public OnPluginStart()
{
RegConsoleCmd("panel_test1", Panel_Test1);
}
public PanelHandler1(Handle:menu, MenuAction:action, param1, param2)
{
if (action == MenuAction_Select)
{
PrintToConsole(param1, "You selected item: %d", param2);
if (param2 == 1)
{
Panel_Test2(param1, 0);
}
}
else if (action == MenuAction_Cancel)
{
PrintToServer("Client %d's menu was cancelled. Reason: %d", param1, param2);
}
}
public PanelHandler2(Handle:menu, MenuAction:action, param1, param2)
{
if (action == MenuAction_Select)
{
PrintToConsole(param1, "You selected item: %d", param2);
if (param2 == 1)
{
Panel_Test1(param1, 0);
}
}
else if (action == MenuAction_Cancel)
{
PrintToServer("Client %d's menu was cancelled. Reason: %d", param1, param2);
}
}
public Action:Panel_Test1(client, args)
{
new Handle:panel = CreatePanel();
DrawPanelItem(panel, "BLUB1");
DrawPanelItem(panel, "BLUB1");
DrawPanelItem(panel, "BLUB1");
DrawPanelItem(panel, "BLUB1");
DrawPanelText(panel, "BLUB1");
SendPanelToClient(panel, client, PanelHandler1, 20);
CloseHandle(panel);
return Plugin_Handled;
}
public Action:Panel_Test2(client, args)
{
new Handle:panel = CreatePanel();
DrawPanelItem(panel, "BLUB2");
DrawPanelItem(panel, "BLUB2");
DrawPanelItem(panel, "BLUB2");
DrawPanelItem(panel, "BLUB2");
DrawPanelText(panel, "BLUB2");
SendPanelToClient(panel, client, PanelHandler2, 20);
CloseHandle(panel);
return Plugin_Handled;
}
|
PHP-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
new Handle:g_hDatabase = INVALID_HANDLE;
public OnPluginStart()
{
SQL_TConnect(sql_Connect, "db_mysql");
}
public sql_Connect(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE)
{
SetFailState("Database failure: %s", error);
}
else
{
g_hDatabase = hndl;
}
CreateTables();
SendQuery("SET NAMES 'utf8'");
}
public sql_Query(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE)
{
ResetPack(data);
decl String:query[512];
ReadPackString(data, query, sizeof(query));
LogError("Query Failed! %s", error);
LogError("Query: %s", query);
}
CloseHandle(data);
}
SendQuery(String:query[])
{
new Handle:dp = CreateDataPack();
WritePackString(dp, query);
SQL_TQuery(g_hDatabase, sql_Query, query, dp);
}
CreateTables()
{
static String:sQuery[] = "\
CREATE TABLE IF NOT EXISTS `db_1`( \
`id` int(11) NOT NULL AUTO_INCREMENT, \
`name` varchar(65) NOT NULL, \
`steamid` varchar(32) NOT NULL, \
`map` varchar(32) NOT NULL, \
`serverip` varchar(16) NOT NULL, \
`serverport` varchar(6) NOT NULL, \
`game` varchar(32) NOT NULL, \
`feedback` varchar(255) NOT NULL, \
`date` timestamp NOT NULL default CURRENT_TIMESTAMP, \
PRIMARY KEY (`id`) \
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
SendQuery(sQuery);
}
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Mathmos« (26. Dezember 2011, 23:02)
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Impact« (26. Dezember 2011, 23:49)
Quellcode |
|
1 2 3 4 |
#if defined _myevents_included #endinput #endif #define _myevents_included |