PHP-Quelltext |
|
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 |
#pragma semicolon 1
#include <sourcemod>
#include <colors>
#define VIP ADMFLAG_RESERVATION
new Handle:cvar_VipJoin;
new Handle:cvar_VipLeave;
public Plugin:myinfo =
{
name = "BlaBla",
author = "BlaBla",
description = "",
version = "1.0",
url = ""
}
public OnPluginStart()
{
cvar_VipJoin = CreateConVar("sm_vip_join", "1", "BlaBla");
cvar_VipLeave = CreateConVar("sm_vip_leave", "1", "BlaBla");
}
public OnClientAuthorized(client, const String:auth[])
{
if(IsClientInGame(client))
{
new String:name[MAX_NAME_LENGTH + 1];
GetClientName(client, name, sizeof(name));
if(cvar_VipJoin && GetUserFlagBits(client) & VIP)
{
PrintToChatAll("{lightgreen}[{green}VIP{lightgreen}] %N, [%s] joined the game, respect him!");
}
}
}
public OnClientDisconnect(client)
{
if(IsClientInGame(client))
{
new String:name[MAX_NAME_LENGTH + 1];
GetClientName(client, name, sizeof(name));
if(cvar_VipLeave && GetUserFlagBits(client) & VIP)
{
PrintToChatAll("{lightgreen}[{green}VIP{lightgreen}] %N [%s] left the game!");
}
}
}
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Impact« (12. Oktober 2013, 16:56)
Hallo,
Bzw. Dein Link geht leider nicht.
MfG,
N3v4R
PHP-Quelltext |
|
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 60 61 62 63 64 65 66 67 68 69 70 |
#pragma semicolon 1
#include <sourcemod>
#include <colors>
#define VIP ADMFLAG_RESERVATION
// Variablen richtig taggen erleichtert einiges
// g -> Global
// h -> Handle
new Handle:g_hVipJoin;
new Handle:g_hipLeave;
public Plugin:myinfo =
{
name = "BlaBla",
author = "BlaBla",
description = "",
version = "1.0",
url = ""
}
public OnPluginStart()
{
// Wir geben den Convars bounds, dadurch können wir später GetConvarBool nutzen
g_hVipJoin = CreateConVar("sm_vip_join", "1", "BlaBla", _, true, 0.0, true, 1.0);
g_hipLeave = CreateConVar("sm_vip_leave", "1", "BlaBla", _, true, 0.0, true, 1.0);
}
// Etwas zu früh, OnClientPutInServer ist besser
public OnClientPutInServer(client)
{
if(IsClientInGame(client))
{
// Benötigt kein +1
//new String:name[MAX_NAME_LENGTH];
// Nicht benötigt da %N
//GetClientName(client, name, sizeof(name));
// Handles checkt man nicht (in diesem Fall), man nutzt dieses Handle um die Convar zu prüfen
// Am besten ist in diesem Falle mit GetConvarBool zu testen (true/false), das geht allerdings nur wenn die Convar Bounds hat
// GetUserFlagbits ist nicht gut, man sollte CheckCommandAcces nutzen
if(GetConVarBool(g_hVipJoin) && CheckCommandAccess(client, "", VIP))
{
// %N benötigt ein parameter
PrintToChatAll("{lightgreen}[{green}VIP{lightgreen}] [%N] joined the game, respect him!", client);
}
}
}
public OnClientDisconnect(client)
{
if(IsClientInGame(client))
{
// Benötigt kein +1
//new String:sName[MAX_NAME_LENGTH];
// Nicht benötigt da %N
//GetClientName(client, sName, sizeof(sName));
// Selbiges wie oben trifft auch hier zu
if(GetConVarBool(g_hipLeave) && CheckCommandAccess(client, "", VIP))
{
PrintToChatAll("{lightgreen}[{green}VIP{lightgreen}] [%N] left the game!", client);
}
}
}
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Impact« (12. Oktober 2013, 16:56)