Sie sind nicht angemeldet.

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.

xEpic-Team

Anfänger

  • »xEpic-Team« ist der Autor dieses Themas

Beiträge: 10

Wohnort: Neuburg a. D.

Beruf: SystemIntegrator

Rootserver vorhanden: Ja

  • Nachricht senden

1

Samstag, 30. Juni 2012, 16:05

Unknow Command public

Hey, wir haben ein Problem mit dem Script hier:

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
}


Fehlermeldungen:

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()


Kann uns einer helfen?

mfg

Jakazuuu

Anfänger

Beiträge: 21

Wohnort: München

Beruf: Student

Rootserver vorhanden: Nein

  • Nachricht senden

2

Samstag, 30. Juni 2012, 16:57

Hey,

Ich bin jetzt zwar auch nicht der Über-Profi, aber änder mal

Quellcode

1
public EventSpawn(Handle:event, const String:name[], bool:dontBroadcast)


in

Quellcode

1
public Action:EventSpawn(Handle:event, const String:name[], bool:dontBroadcast)


EDIT:

Ich denke mal, dass die Funktion "GetMemberstate_Query" von dir kommt und deswegen darfst du da kein public davor schreiben, weil diese Funktion ja nicht von SourceMod kommt.

Bei falschen Aussagen bitte berichtigen. :D


Mit freundlichen Grüßen,

Julian 'Jakazuuu'
Mit freundlichen Grüßen,

Jakazuuu

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Jakazuuu« (30. Juni 2012, 17:27)


xEpic-Team

Anfänger

  • »xEpic-Team« ist der Autor dieses Themas

Beiträge: 10

Wohnort: Neuburg a. D.

Beruf: SystemIntegrator

Rootserver vorhanden: Ja

  • Nachricht senden

3

Samstag, 30. Juni 2012, 19:22

So far so good,
wir habens jetzt auf SQL so geschrieben:

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;
	}


Das sind die neuen Fehler:

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()

Impact

Super Moderator

Beiträge: 1 276

Rootserver vorhanden: Nein

  • Nachricht senden

4

Samstag, 30. Juni 2012, 19:25

Entferne die Negierung in Zeile 52.

PHP-Quelltext

1
if (!SQL_FetchRow(hQuery))

PHP-Quelltext

1
if (SQL_FetchRow(hQuery))

Ich würde dir zudem sehr stark empfehlen Threaded Querys zu benutzen.

MfG
Impact

xEpic-Team

Anfänger

  • »xEpic-Team« ist der Autor dieses Themas

Beiträge: 10

Wohnort: Neuburg a. D.

Beruf: SystemIntegrator

Rootserver vorhanden: Ja

  • Nachricht senden

5

Samstag, 30. Juni 2012, 19:42

Muss ich die Sachen die in der Abfragen ist jetzt nicht auch tauschen?
Für Threaded Querys bin ich noch zu low ^^

Immernoch:

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)