PHP Source code |
|
1 2 3 4 5 6 7 |
AddColumn()
{
decl String:sQuery[512];
Format(sQuery, sizeof(sQuery), "ALTER TABLE meinetabelle ADD `neuspalte` int(12) NULL;");
SendQuery(sQuery);
}
|
PHP Source code |
|
1 |
Format(sQuery, sizeof(sQuery), "IF NOT EXISTS SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ‘meinetabelle’ AND COLUMN_NAME = ‘neuspalte’ ALTER TABLE meinetabelle ADD neuspalte int(12) NULL;");
|
PHP Source code |
|
1 |
CREATE TABLE IF NOT EXISTS players (steamid TEXT UNIQUE, name TEXT, rounds INTEGER, lastconnect DATE);
|
PHP Source code |
|
1 |
select * FROM players WHERE steamid = 'SteamId';
|
PHP Source code |
|
1 |
UPDATE players SET name = 'SomeName' WHERE steamid = 'Someid';
|
PHP Source code |
|
1 |
INSERT INTO players VALUES ('Someid', 'Somename');
|
PHP Source code |
|
1 |
public OnClientAuthorized(client, const String:auth[])
|
PHP Source code |
|
1 |
new bool:iWasChecked[MAXPLAYERS+1];
|
PHP Source code |
|
1 2 3 4 5 6 7 8 |
public OnClientAuthorized(client, const String:auth[])
{
if(!iWasChecked[client])
{
// Irgendwas machen
iWasChecked[client] = true;
}
}
|
...
Allerdings wird diese Funktion auch immer bei Mapchange für jeden Spieler ausgeführt.
Ich hatte auch schon versucht "OnClientConnect" zu benutzen, allerdings bekomme ich da keine SteamID ermittelt.
...
This post has been edited 3 times, last edit by "MadMakz" (Dec 31st 2011, 5:30am)
...
Allerdings wird diese Funktion auch immer bei Mapchange für jeden Spieler ausgeführt.
Ich hatte auch schon versucht "OnClientConnect" zu benutzen, allerdings bekomme ich da keine SteamID ermittelt.
...
OnClientConnect(), OnClientConnected(), OnClientPutInServer(), OnClientAuthorized(), OnClientPostAdminCheck() werden immer nach einem mapwechsel neu feuern und das nicht ohne grund
source lässt die clients nämlich bei jedem mapwechsel neu verbinden.
http://wiki.alliedmods.net/Introduction_…on_mapchange.3F
PHP Source code |
|
1 2 3 4 5 6 7 8 |
/**
* Adds a player to the database.
*
* @param String:name Playername.
* @noreturn
*/
native AddPlayer(const String:name[]);
|
PHP Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
#include <sourcemod>
#include <player>
public OnPluginStart()
{
decl String:name[32];
Format(name, sizeof(name), "test");
PrintToChatAll("Ausgabe1 :%s!", name);
AddPlugin(String:name);
}
|
PHP Source code |
|
1 2 3 4 5 6 7 8 9 10 |
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
CreateNative("AddPlayer", Native_AddPlayer);
return APLRes_Success;
}
public Native_AddPlayer(Handle:plugin, numParams)
{
PrintToChatAll("Ausgabe2 :%s!", GetNativeCell(1));
}
|
This post has been edited 5 times, last edit by "Mathmos" (Jan 5th 2012, 5:43pm)
PHP Source code |
|
1 2 3 4 |
public Native_AddPlayer(Handle:plugin, numParams)
{
PrintToChatAll("Ausgabe2: %s!", GetNativeCell(1));
}
|
PHP Source code |
|
1 2 3 4 5 6 |
public Native_AddPlayer(Handle:plugin, numParams)
{
new String:Buffer[256];
GetNativeString(1, Buffer, sizeof(Buffer));
PrintToChatAll("Ausgabe2: %s!", Buffer);
}
|