Quellcode |
|
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 |
#include <sourcemod> new String:erroraa[255] public OnPluginStart () { HookEvent("player_spawn", EventSpawn) } public EventSpawn(Handle:event, const String:name[], bool:dontBroadcast) { new Handle:db = SQL_DefConnect(erroraa, sizeof(erroraa)) if (db == INVALID_HANDLE) { PrintToServer("Could not connect: %s", erroraa) } new client = GetClientOfUserId(GetEventInt(event, "userid")) new String:Steam_ID[128] GetClientAuthString(client,Steam_ID,sizeof(Steam_ID)) if(GetMemberstate_Query(db,Steam_ID) == 1) { PrintToChatAll("[Debug-Info]: Status 1 User spawned...") } else if(GetMemberstate_Query(db,Steam_ID) == 0) { PrintToChatAll("[Debug-Info]: Status 0 User spawned...") } } public GetMemberstate_Query(Handle:db1, String:ID[128]) { new String:query[100] Format(query, sizeof(query), "SELECT level FROM users WHERE steamid= %s", ID) new Handle:hQuery = SQL_Query(db1, query) if (hQuery == INVALID_HANDLE) { return false } new mlvl while (SQL_FetchRow(hQuery)) { SQL_FetchInt(hQuery, mlvl) } CloseHandle(hQuery) return mlvl } |
Quellcode |
|
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 |
Unknown command "public" Unknown command "{" Unknown command "HookEvent" Unknown command "}" Unknown command "public" Unknown command "{" Unknown command "new" Unknown command "new" Unknown command "if" Unknown command "if" Unknown command "}" Unknown command "public" Unknown command "{" Unknown command "new" Unknown command "Format" Unknown command "new" Unknown command "if" Unknown command "{" Unknown command "return" Unknown command "}" Unknown command "new" Unknown command "while" Unknown command "{" Unknown command "mlvl" Unknown command "}" Unknown command "CloseHandle" Unknown command "return" Unknown command "}" Connection to Steam servers successful. Public IP is 83.136.86.173. Assigned anonymous gameserver Steam ID [A-1:1635453957(3005)]. VAC secure mode is activated. Could not connect: [2002]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) L 06/30/2012 - 14:06:54: [SM] Native "SQL_Query" reported: Invalid database Handle 0 (error: 4) L 06/30/2012 - 14:06:54: [SM] Displaying call stack trace for plugin "test.smx": L 06/30/2012 - 14:06:54: [SM] [0] Line 34, /groups/sourcemod/upload_tmp/textmUGtDH.sp::GetMemberstate_Query() L 06/30/2012 - 14:06:54: [SM] [1] Line 19, /groups/sourcemod/upload_tmp/textmUGtDH.sp::EventSpawn() Could not connect: [2002]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) L 06/30/2012 - 14:06:54: [SM] Native "SQL_Query" reported: Invalid database Handle 0 (error: 4) L 06/30/2012 - 14:06:54: [SM] Displaying call stack trace for plugin "test.smx": L 06/30/2012 - 14:06:54: [SM] [0] Line 34, /groups/sourcemod/upload_tmp/textmUGtDH.sp::GetMemberstate_Query() L 06/30/2012 - 14:06:54: [SM] [1] Line 19, /groups/sourcemod/upload_tmp/textmUGtDH.sp::EventSpawn() Could not connect: [2002]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) L 06/30/2012 - 14:06:54: [SM] Native "SQL_Query" reported: Invalid database Handle 0 (error: 4) L 06/30/2012 - 14:06:54: [SM] Displaying call stack trace for plugin "test.smx": L 06/30/2012 - 14:06:54: [SM] [0] Line 34, /groups/sourcemod/upload_tmp/textmUGtDH.sp::GetMemberstate_Query() L 06/30/2012 - 14:06:54: [SM] [1] Line 19, /groups/sourcemod/upload_tmp/textmUGtDH.sp::EventSpawn() Could not connect: [2002]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) L 06/30/2012 - 14:06:54: [SM] Native "SQL_Query" reported: Invalid database Handle 0 (error: 4) L 06/30/2012 - 14:06:54: [SM] Displaying call stack trace for plugin "test.smx": L 06/30/2012 - 14:06:54: [SM] [0] Line 34, /groups/sourcemod/upload_tmp/textmUGtDH.sp::GetMemberstate_Query() L 06/30/2012 - 14:06:54: [SM] [1] Line 19, /groups/sourcemod/upload_tmp/textmUGtDH.sp::EventSpawn() |
Quellcode |
|
1 |
public EventSpawn(Handle:event, const String:name[], bool:dontBroadcast) |
Quellcode |
|
1 |
public Action:EventSpawn(Handle:event, const String:name[], bool:dontBroadcast) |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Jakazuuu« (30. Juni 2012, 17:27)
Quellcode |
|
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 |
#include <sourcemod> public bool:OnClientConnect(client, String:rejectmsg[], maxlen) { CreateTimer(15.0, Timer_Advertise, client); return true; } public Action:Timer_Advertise(Handle:timer, any:client) { new String:welcome[128]; new String:Member_String[35]; new is_Member; is_Member = Member_State(client); if(is_Member) { Format( Member_String, sizeof(Member_String), "Member und gehörst zum Team!"); } else { Format( Member_String, sizeof(Member_String), "Neuling und gehörst nicht zum Team!"); } new String:player_name[32]; GetClientName(client, player_name, sizeof(player_name)); Format( welcome, sizeof(welcome), "Hallo %s! Du bist %s!",player_name,Member_String); if (IsClientInGame(client)) PrintToChatAll(welcome); else if (IsClientConnected(client)) CreateTimer(15.0, Timer_Advertise, client); } public Member_State(client) { new Handle: hQuery; new String: error[128]; new Handle:db = SQL_Connect("default", true, error, sizeof(error)); if (db == INVALID_HANDLE) { PrintToServer("Die MySQL-Verbindung konnte nicht aufgebaut werden. GRUND: %s", error); PrintToChatAll("Die MySQL-Verbindung konnte nicht aufgebaut werden. GRUND: %s", error); CloseHandle(db); return true; } new String:query[255]; new String:steam_id[32]; new Member_Level; GetClientAuthString(client, steam_id, sizeof(steam_id)); Format( query, sizeof(query), "SELECT level FROM user WHERE steamid='%s'", steam_id); hQuery = SQL_Query(db,query); if (!SQL_FetchRow(hQuery)) { Member_Level = SQL_FetchInt(hQuery,0); } else { Member_Level = 0; } return Member_Level; } |
Quellcode |
|
1 2 3 4 5 6 7 8 |
L 06/30/2012 - 17:19:52: [SM] Native "SQL_FetchInt" reported: Current result set has no fetched rows L 06/30/2012 - 17:19:52: [SM] Displaying call stack trace for plugin "test.smx": L 06/30/2012 - 17:19:52: [SM] [0] Line 52, /groups/sourcemod/upload_tmp/textHXIkHe.sp::Member_State() L 06/30/2012 - 17:19:52: [SM] [1] Line 14, /groups/sourcemod/upload_tmp/textHXIkHe.sp::Timer_Advertise() L 06/30/2012 - 17:19:52: [SM] Native "SQL_FetchInt" reported: Current result set has no fetched rows L 06/30/2012 - 17:19:52: [SM] Displaying call stack trace for plugin "test.smx": L 06/30/2012 - 17:19:52: [SM] [0] Line 52, /groups/sourcemod/upload_tmp/textHXIkHe.sp::Member_State() L 06/30/2012 - 17:19:52: [SM] [1] Line 14, /groups/sourcemod/upload_tmp/textHXIkHe.sp::Timer_Advertise() |
PHP-Quelltext |
|
1 |
if (!SQL_FetchRow(hQuery))
|
PHP-Quelltext |
|
1 |
if (SQL_FetchRow(hQuery))
|
Quellcode |
|
1 2 3 4 5 6 7 8 |
L 06/30/2012 - 17:55:22: [SM] Native "SQL_FetchInt" reported: Current result set has no fetched rows L 06/30/2012 - 17:55:22: [SM] Displaying call stack trace for plugin "test.smx": L 06/30/2012 - 17:55:22: [SM] [0] Line 56, /groups/sourcemod/upload_tmp/textoxjIX2.sp::Member_State() L 06/30/2012 - 17:55:22: [SM] [1] Line 14, /groups/sourcemod/upload_tmp/textoxjIX2.sp::Timer_Advertise() L 06/30/2012 - 17:55:22: [SM] Native "SQL_FetchInt" reported: Current result set has no fetched rows L 06/30/2012 - 17:55:22: [SM] Displaying call stack trace for plugin "test.smx": L 06/30/2012 - 17:55:22: [SM] [0] Line 56, /groups/sourcemod/upload_tmp/textoxjIX2.sp::Member_State() L 06/30/2012 - 17:55:22: [SM] [1] Line 14, /groups/sourcemod/upload_tmp/textoxjIX2.sp::Timer_Advertise() |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »xEpic-Team« (30. Juni 2012, 20:22)