Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSS[REQUEST] Can someone fix this code that was generated with chatgpt?


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Hello i dont know how to code but i wanted to see if chatgpt could create me a csgo plugin that i want in my server

I wanted to make a plugin would reward online players 10 points every minute


Can someone fix this?

#include <sourcemod>

public void OnPluginStart()
{
// Register the command to reward players
RegConsoleCmd("reward", Cmd_Reward);

// Create a timer to reward players every minute
CreateTimer(60.0, Timer_Reward, _, TIMER_REPEAT);
}

public Action Cmd_Reward(int client, const char[] args)
{
// Get the client's SteamID
new steamid[20];
GetClientAuthId(client, steamid, sizeof(steamid));

// Reward the client with 100 points
RewardPlayer(steamid, 100);

return Plugin_Handled;
}

public Action Timer_Reward(Handle timer)
{
// Loop through all connected clients
for (int i = 1; i <= MaxClients; i++)
{
// Check if the client is connected
if (IsClientInGame(i))
{
// Get the client's SteamID
new steamid[20];
GetClientAuthId(i, steamid, sizeof(steamid));

// Reward the client with 10 points
RewardPlayer(steamid, 10);
}
}

return Plugin_Continue;
}

public void RewardPlayer(const char[] steamid, int points)
{
// Open a connection to the MySQL database
new database = SQL_Connect("localhost", "username", "password", "database");

// Check if the connection was successful
if (SQL_IsError(database))
{
LogError("Failed to connect to database: %s", SQL_GetLastError());
return;
}

// Create the query string
new query[256];
Format(query, sizeof(query), "INSERT INTO rewards (steamid, points) VALUES ('%s', %d)", steamid, points);

// Execute the query
new result = SQL_Query(database, query);

// Check if the query was successful
if (SQL_IsError(result))
{
LogError("Failed to execute query: %s", SQL_GetLastError());
}

// Free the query result
SQL_FreeResult(result);

// Close the database connection
SQL_Disconnect(database);
}



i am getting these errors
(50) : error 017: undefined symbol "SQL_IsError"
(52) : error 017: undefined symbol "SQL_GetLastError"
(64) : error 017: undefined symbol "SQL_IsError"
(70) : error 017: undefined symbol "SQL_FreeResult"
(73) : error 017: undefined symbol "SQL_Disconnect"

any help would be useful

Attached Files
File Type: sp Get Plugin or Get Source (newplugin.sp - 2.0 KB)

Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...