D
DozoR1
Добрый день. Посмотрел мануал на странице: http://duxa72.blogspot.ru/2012/09/sourcepawn-steam-id.html
Ясно, что это "издержки" редактора:
Собственно, получившийся код при компилировании:
При компилировании плагина возникли 5 ошибок:
Помогите решить проблему.
UP:
Есть подозрение, что вместо
Должно быть
Ясно, что это "издержки" редактора:
PHP:
</sourcemod>
PHP:
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "0.0.3"
#define PHRASES "translations/RegSys.phrases.txt"
#define TIME 3.0
#define DEBUG
// --MySQL-------------------------------------------------------------------------------
new String:MySQL_SelectTables[] = "SELECT %s, %s FROM %s WHERE %s REGEXP '^STEAM_[0-9]:%s$';";
new String:MySQL_UpdateTables[] = "UPDATE %s SET %s = '1', %s = '%d' WHERE %s REGEXP '^STEAM_[0-9]:%s$';";
// --SQLite------------------------------------------------------------------------------
new String:SQLite_SelectTables[] = "SELECT %s, %s FROM %s WHERE %s = '%s';";
new String:SQLite_UpdateTables[] = "UPDATE %s SET %s = '1', %s = '%d' WHERE %s = '%s';";
// --------------------------------------------------------------------------------------
new String:szDatabase[64],
String:szTimeEnd[64],
String:szActive[64],
String:szSteamID[64],
String:szTimeActive[64];
new Handle:ClientRecheck[MAXPLAYERS+1];
new Handle:db = INVALID_HANDLE;
new Handle:sm_rs_tb = INVALID_HANDLE;
new Handle:sm_rs_tb_steamid = INVALID_HANDLE;
new Handle:sm_rs_tb_active = INVALID_HANDLE;
new Handle:sm_rs_tb_te = INVALID_HANDLE;
new Handle:sm_rs_tb_ta = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "RegSys",
author = "duxa",
description = "Registration System",
version = PLUGIN_VERSION,
url = ""
}
public OnPluginStart()
{
decl String:szPath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, szPath, sizeof(szPath), "%s", PHRASES);
if(!FileExists(szPath))
{
PrintToServer("[RegSys] Cannot find the translations for \"RegSys\"");
LogError("[RegSys] Cannot find the translations for \"RegSys\"");
return;
}
LoadTranslations("RegSys.phrases");
CreateConVar("sm_rs_version", PLUGIN_VERSION, _, FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_DONTRECORD|FCVAR_NOTIFY);
sm_rs_tb = CreateConVar("sm_rs_tb", "reg_data", "The name table");
sm_rs_tb_steamid = CreateConVar("sm_rs_tb_steamid", "STEAM_ID", "The name table with STEAM_ID");
sm_rs_tb_active = CreateConVar("sm_rs_tb_active", "active", "The name table with the state of activation");
sm_rs_tb_te = CreateConVar("sm_rs_tb_te", "time_end", "The name table with end time");
sm_rs_tb_ta = CreateConVar("sm_rs_tb_ta", "time_active", "The name table for activation time");
HookConVarChange(sm_rs_tb, OnSettingChanged);
HookConVarChange(sm_rs_tb_steamid, OnSettingChanged);
HookConVarChange(sm_rs_tb_active, OnSettingChanged);
HookConVarChange(sm_rs_tb_te, OnSettingChanged);
HookConVarChange(sm_rs_tb_ta, OnSettingChanged);
AutoExecConfig(true, "RegSys");
}
public OnConfigsExecuted()
{
if(!SQL_CheckConfig("RegSys"))
{
PrintToServer("[RegSys] Database failure: Could not find Database conf \"RegSys\"");
LogError("[RegSys] Database failure: Could not find Database conf \"RegSys\"");
return;
}
GetConVarString(sm_rs_tb, szDatabase, sizeof(szDatabase));
GetConVarString(sm_rs_tb_te, szTimeEnd, sizeof(szTimeEnd));
GetConVarString(sm_rs_tb_active, szActive, sizeof(szActive));
GetConVarString(sm_rs_tb_steamid, szSteamID, sizeof(szSteamID));
GetConVarString(sm_rs_tb_ta, szTimeActive, sizeof(szTimeActive));
#if defined DEBUG
PrintToServer("OnConfigsExecuted: TB = %s, TE = %s, A = %s, S = %s, TA = %s", szDatabase, szTimeEnd, szActive, szSteamID, szTimeActive);
#endif
SQL_TConnect(GotDatabase, "RegSys");
}
public OnSettingChanged(Handle:convar, const String:oldValue[], const String:newValue[])
{
if(convar == sm_rs_tb)
{
if(!StrEqual(oldValue, newValue))
{
GetConVarString(convar, szDatabase, sizeof(szDatabase));
}
} else
if(convar == sm_rs_tb_te)
{
if(!StrEqual(oldValue, newValue))
{
GetConVarString(convar, szTimeEnd, sizeof(szTimeEnd));
}
} else
if(convar == sm_rs_tb_active)
{
if(!StrEqual(oldValue, newValue))
{
GetConVarString(convar, szActive, sizeof(szActive));
}
} else
if(convar == sm_rs_tb_steamid)
{
if(!StrEqual(oldValue, newValue))
{
GetConVarString(convar, szSteamID, sizeof(szSteamID));
}
} else
if(convar == sm_rs_tb_ta)
{
if(!StrEqual(oldValue, newValue))
{
GetConVarString(convar, szTimeActive, sizeof(szTimeActive));
}
}
#if defined DEBUG
PrintToServer("OnSettingChanged: TB = %s, TE = %s, A = %s, S = %s, TA = %s", szDatabase, szTimeEnd, szActive, szSteamID, szTimeActive);
#endif
}
public GotDatabase(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if(hndl == INVALID_HANDLE)
{
PrintToServer("[RegSys] Unable to connect to database");
LogError("[RegSys] Unable to connect to database (%s)", error);
return;
}
db = hndl;
}
public OnClientAuthorized(client, const String:auth[])
{
if(auth[0] == 'B' || auth[9] == 'L' || IsFakeClient(client) || db == INVALID_HANDLE) return;
decl String:szQuery[256];
new String:szIdent[16];
SQL_ReadDriver(db, szIdent, sizeof(szIdent));
if(strcmp(szIdent, "mysql") == 0)
{
Format(szQuery, sizeof(szQuery), MySQL_SelectTables, szTimeEnd, szActive, szDatabase, szSteamID, auth[8]);
} else
if(strcmp(szIdent, "sqlite") == 0)
{
Format(szQuery, sizeof(szQuery), SQLite_SelectTables, szTimeEnd, szActive, szDatabase, szSteamID, auth);
} else
{
PrintToServer("[RegSys] Unknown driver type.");
LogError("[RegSys] Unknown driver type.");
return;
}
#if defined DEBUG
PrintToServer("OnClientAuthorized(%d): %s", client, szQuery);
#endif
SQL_TQuery(db, T_Check, szQuery, client);
}
public OnClientDisconnect_Post(client)
{
if(ClientRecheck[client] != INVALID_HANDLE)
{
CloseHandle(ClientRecheck[client]);
ClientRecheck[client] = INVALID_HANDLE;
}
}
public Action:Recheck(Handle:timer, any:client)
{
decl String:szClientSteamID[21];
GetClientAuthString(client, szClientSteamID, sizeof(szClientSteamID));
OnClientAuthorized(client, szClientSteamID);
}
public T_Check(Handle:owner, Handle:hndl, const String:error[], any:client)
{
if(hndl == INVALID_HANDLE)
{
#if defined DEBUG
PrintToServer("T_Check(%d): %s", client, error);
#endif
KickClient(client, "%t", "Error Miss");
return;
}
if(SQL_FetchRow(hndl))
{
new time_end,
active;
time_end = SQL_FetchInt(hndl, 0);
active = SQL_FetchInt(hndl, 1);
if(active == 1)
{
KickClient(client, "%t", "Already Confirmed");
return;
}
if(time_end > GetTime())
{
decl String:szQuery[256];
decl String:szClientSteamID[21];
new String:szIdent[16];
GetClientAuthString(client, szClientSteamID, sizeof(szClientSteamID));
SQL_ReadDriver(db, szIdent, sizeof(szIdent));
if(strcmp(szIdent, "mysql") == 0)
{
Format(szQuery, 255, MySQL_UpdateTables, szDatabase, szActive, szTimeActive, GetTime(), szSteamID, szClientSteamID[8]);
} else
if(strcmp(szIdent, "sqlite") == 0)
{
Format(szQuery, 255, SQLite_UpdateTables, szDatabase, szActive, szTimeActive, GetTime(), szSteamID, szClientSteamID);
} else
{
PrintToServer("[RegSys] Unknown driver type.");
LogError("[RegSys] Unknown driver type.");
return;
}
#if defined DEBUG
PrintToServer("T_Check(%d): %s", client, szQuery);
#endif
SQL_TQuery(db, SQL_CheckCallback, szQuery, client);
} else
{
KickClient(client, "%t", "Error Time");
return;
}
} else
{
KickClient(client, "%t", "Error Miss");
return;
}
}
public SQL_CheckCallback(Handle:owner, Handle:hndl, const String:error[], any:client)
{
if(hndl == INVALID_HANDLE)
{
ClientRecheck[client] = CreateTimer(TIME, Recheck, client);
return;
}
#if defined DEBUG
decl String:szClientSteamID[21];
GetClientAuthString(client, szClientSteamID, sizeof(szClientSteamID));
PrintToServer("SQL_CheckCallback(%d): '%s' was confirmed", client, szClientSteamID);
#endif
KickClient(client, "%t", "Confirm");
}
/home/groups/sourcemod/upload_tmp/phpXv1Fju.sp(1) : error 055: start of function body without function header
/home/groups/sourcemod/upload_tmp/phpXv1Fju.sp(18) : error 010: invalid function or declaration
/home/groups/sourcemod/upload_tmp/phpXv1Fju.sp(22) : error 010: invalid function or declaration
/home/groups/sourcemod/upload_tmp/phpXv1Fju.sp(31) : error 010: invalid function or declaration
/home/groups/sourcemod/upload_tmp/phpXv1Fju.sp(41) : error 010: invalid function or declaration
Помогите решить проблему.
UP:
Есть подозрение, что вместо
PHP:
public Plugin:myinfo =
{
name = "RegSys",
author = "duxa",
description = "Registration System",
version = PLUGIN_VERSION,
url = ""
}
Должно быть
PHP:
public Plugin:myinfo =
{
name = "RegSys",
author = "duxa",
description = "Registration System",
version = PLUGIN_VERSION,
url = ""
};
Последнее редактирование модератором: