#include <a_samp>
#include <dini>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COLOR_RED 0xFF0000FF
#define PM 0x66FF99FF
#define AdminPM 0xFF6600FF
#define INFO 0x66FF00FF
#define AdminChat 0xFF00FFFF
#define CMDMSG 0x00CC99FF
#define AFK 0xCC33CCFF
#define Text 0xFFFF66FF
new Text3D:label[MAX_PLAYERS];
enum admin_daten
{
PW,
IP,
AdminLevel,
Loggedin,
Float:Spawnx,Float:Spawny,Float:Spawnz,
AdminSkin
}
new Admin[MAX_PLAYERS][admin_daten];
new Spec[MAX_PLAYERS];
new IsJailed[MAX_PLAYERS];
new IsMuted[MAX_PLAYERS];
new IsAFK[MAX_PLAYERS];
new IsFrozen[MAX_PLAYERS];
new string1[256];
public OnGameModeInit(){
return 1;
}
new ip[16], accSpeicherung[128],pw[32],playername[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(kick,4,cmdtext);
dcmd(akill, 5,cmdtext);
return 0;
}
public OnPlayerSpawn(playerid)
{
if(Admin[playerid][AdminLevel] == 1 || Admin[playerid][AdminLevel] == 2 || Admin[playerid][AdminLevel] == 3){
label[playerid] = Create3DTextLabel(">)Server Admin(<",Text,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.75);}
else if(Admin[playerid][AdminLevel] > 1336){
label[playerid] = Create3DTextLabel(">)Server Admin Level 1337(<",Text,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.75);}
GetPlayerName(playerid,playername,sizeof(playername));
format(accSpeicherung,sizeof accSpeicherung,"Admins/%s.sav",playername);
if(dini_Isset(accSpeicherung,"Spawnx"))
{
Admin[playerid][Spawnx] = dini_Float(accSpeicherung,"Spawnx");
Admin[playerid][Spawny] = dini_Float(accSpeicherung,"Spawny");
Admin[playerid][Spawnz] = dini_Float(accSpeicherung,"Spawnz");
SetPlayerPos(playerid,Admin[playerid][Spawnx],Admin[playerid][Spawny],Admin[playerid][Spawnz]);
if (dini_Int(accSpeicherung, "AdminSkin") != -1){
Admin[playerid][AdminSkin] = dini_Int(accSpeicherung,"AdminSkin");
SetPlayerSkin(playerid,Admin[playerid][AdminSkin]);}}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
GetPlayerName(playerid,playername,sizeof playername);
format(accSpeicherung,sizeof accSpeicherung,"Admins/%s.sav",playername);
if(IsPlayerNPC(playerid)){
return 1; }
if(fexist(accSpeicherung) && Admin[playerid][Loggedin]== 0)
{
SendClientMessage(playerid,COLOR_RED,"Du trägst einen Adminnamen! Bitte ändere ihn!");
return 0;
}
if(Admin[playerid][AdminLevel] == -2)
{
SendClientMessage(playerid,COLOR_RED,"Du musst dich erst freischalten lassen bevor du spawnen kannst!");
return 0;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
Admin[playerid][Loggedin] = 0;
Delete3DTextLabel(label[playerid]);
return 1;
}
//----------------------------------------------------------------------------DCMD--------------------------------------
dcmd_aregister(playerid,params[]){
GetPlayerName(playerid,playername,sizeof(playername));
format(accSpeicherung,sizeof accSpeicherung,"Admins/%s.sav",playername);
if(sscanf(params, "s",pw)) {
return SendClientMessage(playerid,COLOR_RED,"Benutze /aregister [PW max. 16 Zeichen]!");}
dini_Create(accSpeicherung);
dini_Set(accSpeicherung,"PW",pw);
dini_Set(accSpeicherung,"AdminLevel", "-2");
GetPlayerIp(playerid,ip,sizeof(ip));
dini_Set(accSpeicherung,"IP",ip);
Admin[playerid][Spawnx] = dini_Float(accSpeicherung,"Spawnx");
Admin[playerid][Spawny] = dini_Float(accSpeicherung,"Spawny");
Admin[playerid][Spawnz] = dini_Float(accSpeicherung,"Spawnz");
dini_Set(accSpeicherung,"AdminSkin","-1");
Admin[playerid][Loggedin] = 1;
SendClientMessage(playerid,0xFFFFFFFF,"AdminAccount wurde angelegt!");
return 1;
}
dcmd_alogin(playerid,params[]){
GetPlayerName(playerid,playername,sizeof(playername));
format(accSpeicherung,sizeof accSpeicherung,"Admins/%s.sav",playername);
if(!fexist(accSpeicherung)&& Admin[playerid][Loggedin]== 0) {
return SendClientMessage(playerid,0xFFFFFFFF,"SERVER: Unknown command."); }
if(sscanf(params, "s",pw)) {
return SendClientMessage(playerid,COLOR_RED,"Kein Passwort angegeben!");
}
if(strcmp(pw,dini_Get(accSpeicherung,"PW")) == 0)
{
Admin[playerid][Loggedin] = 1;
GetPlayerIp(playerid,ip,sizeof(ip));
dini_Set(accSpeicherung,"IP",ip);
dini_Get(accSpeicherung,"AdminLevel");
Admin[playerid][AdminLevel] = dini_Int(accSpeicherung,"AdminLevel");
format(string1,sizeof (string1),"Du wurdest erfolgreich eingeloggt!(Level:%d)", Admin[playerid][AdminLevel] );
SendClientMessage(playerid,INFO,string1);
SendClientMessage(playerid,INFO,"Siehe Adminregeln unter /adminr und Adminbefehle unter /adminb!");
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
if(dini_Isset(accSpeicherung,"Spawnx"))
{
Admin[playerid][Spawnx] = dini_Float(accSpeicherung,"Spawnx");
Admin[playerid][Spawny] = dini_Float(accSpeicherung,"Spawny");
Admin[playerid][Spawnz] = dini_Float(accSpeicherung,"Spawnz");
SpawnPlayer(playerid);
SetPlayerPos(playerid,Admin[playerid][Spawnx],Admin[playerid][Spawny],Admin[playerid][Spawnz]);
if (dini_Int(accSpeicherung, "AdminSkin") != -1){
Admin[playerid][AdminSkin] = dini_Int(accSpeicherung,"AdminSkin");
SetPlayerSkin(playerid,Admin[playerid][AdminSkin]);}}
}
else
{
SendClientMessage(playerid,COLOR_RED,"Das Passwort war Falsch!");
SendClientMessage(playerid,COLOR_RED,"Versuche es erneut!");
}return 1;}
dcmd_kick(playerid,params[]) {
new
pID;
if(!fexist(accSpeicherung)&& Admin[playerid][Loggedin]== 0) {
return SendClientMessage(playerid,0xFFFFFFFF,"SERVER: Unknown command."); }
if(sscanf(params, "uz",pID,string1)) {
return SendClientMessage(playerid,COLOR_RED,"USAGE: /kick ID Grund");
}
if (pID == INVALID_PLAYER_ID){
return SendClientMessage(playerid,COLOR_RED,"Kein Spieler mit angegebener ID Online");
}
if (pID == playerid){
return SendClientMessage(playerid,COLOR_RED,"Du kannst dich nicht selber kicken!");
}
if(Admin[playerid][AdminLevel] > -1){
new ThePlayer[MAX_PLAYER_NAME];
GetPlayerName(pID,ThePlayer,sizeof(ThePlayer));
format(string1,sizeof(string1),"%s (ID:%d) wurde vom Server gekickt!(Grund: %s)",ThePlayer,pID,string1[0] ? string1 : "<Kein Grund>");
SendClientMessageToAll(COLOR_RED,string1);
printf(string1);
Kick(pID);
}
return 1;}
dcmd_akill(playerid,params[]) {
new pID, pname[MAX_PLAYER_NAME];
if(!fexist(accSpeicherung)&& Admin[playerid][Loggedin]== 0) {
return SendClientMessage(playerid,0xFFFFFFFF,"SERVER: Unknown command.");}
if(sscanf(params, "u",pID)) {
return SendClientMessage(playerid,COLOR_RED,"USAGE: /akill [ID]");}
if (pID == INVALID_PLAYER_ID){
return SendClientMessage(playerid,COLOR_RED,"Kein Spieler mit angegebener ID Online");}
if(Admin[playerid][AdminLevel] > 0){
GetPlayerName(pID, pname, sizeof(pname));
format(string1, sizeof(string1), "Du hast %s getötet!", pname );
SendClientMessage(playerid, INFO, string1);
SetPlayerHealth(pID, 0);}
return 1;}
so sieht es aus wenn sich ein admin einlogt mit /alogin hat jeder spieler die selben rechte obwohl diese nicht einmal aregister gemacht haben und garkein AdminLevel besitzen warum passiert das ?