Hallo Leute.
Brauche schnell eure Hilfe.
Unzwar möchte ich den Befehl /admins in meinen Server einfügen.
Kann mir da jemand was helfen? Ich krieg es einfach nicht hin
mfg
Hallo Leute.
Brauche schnell eure Hilfe.
Unzwar möchte ich den Befehl /admins in meinen Server einfügen.
Kann mir da jemand was helfen? Ich krieg es einfach nicht hin
mfg
if(strcmp(cmd, "/admins", true) == 0)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "|Teammitglieder");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 2001)
{
if(PlayerInfo[i][pAdmin] == 2000) { admtext = "2000* Owner-|"; }
else if(PlayerInfo[i][pAdmin] == 1339) { admtext = "1339* Script Leitung -|"; }
else if(PlayerInfo[i][pAdmin] == 1338) { admtext = "1338* Server Manager -|"; }
else if(PlayerInfo[i][pAdmin] == 1337) { admtext = "1337* Super Administrator -|"; }
else if(PlayerInfo[i][pAdmin] == 4) { admtext = "4* Administrator -|"; }
else if(PlayerInfo[i][pAdmin] == 3) { admtext = "3* Super Moderator -|"; }
else if(PlayerInfo[i][pAdmin] == 2) { admtext = "2* Moderator -|"; }
else if(PlayerInfo[i][pAdmin] == 1) { admtext = "1* Supporter -|"; }
else { admtext = "Administrator"; }
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "|- %s %s ID: %d Telefonnummer: %d", admtext, sendername,i,PlayerInfo[i][pPnumber]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
}
return 1;
}
Alles anzeigenif(strcmp(cmd, "/admins", true) == 0)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "|Teammitglieder");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[pAdmin] >= 1 && PlayerInfo[pAdmin] < 2001)
{
if(PlayerInfo[pAdmin] == 2000) { admtext = "2000* Owner-|"; }
else if(PlayerInfo[pAdmin] == 1339) { admtext = "1339* Script Leitung -|"; }
else if(PlayerInfo[i][pAdmin] == 1338) { admtext = "1338* Server Manager -|"; }
else if(PlayerInfo[i][pAdmin] == 1337) { admtext = "1337* Super Administrator -|"; }
else if(PlayerInfo[i][pAdmin] == 4) { admtext = "4* Administrator -|"; }
else if(PlayerInfo[i][pAdmin] == 3) { admtext = "3* Super Moderator -|"; }
else if(PlayerInfo[i][pAdmin] == 2) { admtext = "2* Moderator -|"; }
else if(PlayerInfo[i][pAdmin] == 1) { admtext = "1* Supporter -|"; }
else { admtext = "Administrator"; }
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "|- %s %s ID: %d Telefonnummer: %d", admtext, sendername,i,PlayerInfo[i][pPnumber]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
}
return 1;
}[/i][/i][/i][/i][/i][/i][/i]
geht das auch im ocmd?
Wenn da noch Stock oder so fehlt. Kannst du den mir auch schreiben?
Den hatte ich mal genutzt früher, musst halt anpassen & mit den Dialogen, Rängen, etc.
ocmd:admins(playerid,params[]) {
#pragma unused params
new plname[MAX_PLAYER_NAME],result[500],string[256],sendername[MAX_PLAYER_NAME],strings[228];
foreach(Player, i){
if(!IsPlayerNPC(i)) {
if(PlayerInfo[i][pAdmin] == 0) continue;
GetPlayerName(i, plname, sizeof(plname));
GetPlayerName(i, sendername, sizeof(sendername));
if(AdminDuty[i] == 1) format(string, sizeof(string), "{00FF00}[IM DIENST] %s | Nummer: %d\n", plname,PlayerInfo[i][pPnumber]);
else if(M_Bot[i][PAFK] == 1) format(string,sizeof(string),"{FF0000}[AWAY] %s | Nummer: %d\n", plname,PlayerInfo[i][pPnumber]);
else if(PlayerInfo[i][pAdmin] == 1) format(string,sizeof(string),"%s | Probe Supporter | Nummer: %d\n",plname,PlayerInfo[i][pPnumber]);
else if(PlayerInfo[i][pAdmin] == 2) format(string,sizeof(string),"%s | Supporter | Nummer: %d\n",plname,PlayerInfo[i][pPnumber]);
else if(PlayerInfo[i][pAdmin] == 3) format(string,sizeof(string),"%s | Moderator | Nummer: %d\n",plname,PlayerInfo[i][pPnumber]);
else if(PlayerInfo[i][pAdmin] == 4) format(string,sizeof(string),"%s | Admin | Nummer: %d\n",plname,PlayerInfo[i][pPnumber]);
else if(PlayerInfo[i][pAdmin] == 5) format(string,sizeof(string),"%s | High Admin | Nummer: %d\n",plname,PlayerInfo[i][pPnumber]);
else if(PlayerInfo[i][pAdmin] == 6) format(string,sizeof(string),"%s | Communitymanager | Nummer: %d\n",plname,PlayerInfo[i][pPnumber]);
else if(PlayerInfo[i][pAdmin] == 7)format(string,sizeof(string),"%s | Communityleiter | Nummer: %d\n\n",plname,PlayerInfo[i][pPnumber]);
result = str_combine_large(result, string);
}
}
if(strlen(result) < 5) {
format(strings, sizeof(strings),"{FF0000}Zurzeit ist kein Admin verfügbar! Sollte dir das /help System nicht helfen, so melde dich\ndoch bitte auf unserem Teamspeak Server (IP: %s)\nOder in unserem Forum (URL: %s)",TEAMSPEAKIP,FORUMURL);
ShowPlayerDialog(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"Administratoren & Supporter",strings,"Ok","");
} else ShowPlayerDialog(playerid,DIALOG_ADMINS,DIALOG_STYLE_LIST,"Administratoren & Supporter",result,"Ok","");
return 1;
}
Du solltest das Ganze ja auch auf dein Script anpassen
Hier mal mein Code: ( eben geschrieben, sollte funktionieren )
static const Adminname[][] = {"User","Supporter","Administrator","High Administrator","Projektleiter"}; //Beispiel
#define dAdmins 500
ocmd:admins(playerid){
new str[512],buffer[64],p_name[MAX_PLAYER_NAME]; // Eventuell anpassen
for(new i = 0; i<MAX_PLAYERS; i++){
if(!IsPlayerConnected(i))continue;
if(Spieler[i][Admin] <= 0)continue; // "Spieler[i][Admin]" zu deinem anpassen!
GetPlayerName(i,p_name,MAX_PLAYER_NAME);
format(buffer,sizeof(buffer),"'%s' %s%c",Adminname[Spieler[i][Admin]],p_name,(i == MAX_PLAYERS) ? '\0' : '\n'),strins(str,strlen(str),sizeof(str));
}
if(strlen(str))return ShowPlayerDialog(playerid,dAdmins,DIALOG_STYLE_MSGBOX,"Admins online",str,"Okay","");
else return ShowPlayerDialog(playerid,dAdmins,DIALOG_STYLE_MSGBOX,"Admins online","Zur Zeit sind keine Admins online!","Okay","");
}
Hier musst du eben nur die Adminnamen, die DialogID und die Adminabfrage abändern...
Alles anzeigenDu solltest das Ganze ja auch auf dein Script anpassen
Hier mal mein Code: ( eben geschrieben, sollte funktionieren )
static const Adminname[][] = {"User","Supporter","Administrator","High Administrator","Projektleiter"}; //Beispiel
#define dAdmins 500
ocmd:admins(playerid){
new str[512],buffer[64],p_name[MAX_PLAYER_NAME]; // Eventuell anpassen
for(new i = 0; i<max_players; i++){
if(!IsPlayerConnected(i))continue;
if(Spieler[i][Admin] <= 0)continue; // "Spieler[i][Admin]" zu deinem anpassen!
GetPlayerName(i,p_name,MAX_PLAYER_NAME);
format(buffer,sizeof(buffer),"'%s' %s%c",Adminname[Spieler[i][Admin]],p_name,(i == MAX_PLAYERS) ? '\0' : '\n'),strins(str,strlen(str),sizeof(str));
}
if(strlen(str))return ShowPlayerDialog(playerid,dAdmins,DIALOG_STYLE_MSGBOX,"Admins online",str,"Okay","");
else return ShowPlayerDialog(playerid,dAdmins,DIALOG_STYLE_MSGBOX,"Admins online","Zur Zeit sind keine Admins online!","Okay","");
}
Hier musst du eben nur die Adminnamen, die DialogID und die Adminabfrage abändern...
Helf mir ich bekommst nicht hin.
Vielleicht kannst du hier mit etwas anfangen
if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,0xB4B4B4FF,"Du hast nicht den jeweiligen Adminrang.");
Ich bin ein Anfänger was Scripten angeht
"Spieler" wird mich auch als fehler etc. angezeigt
FrakJumper: Suche mal in deinem Script nach "stock IsPlayerAnAdmin" & poste den Code hier rein..
FrakJumper: Suche mal in deinem Script nach "stock IsPlayerAnAdmin" & poste den Code hier rein..
stock isPlayerAnAdmin(playerid,rang)
{
if(GetPVarInt(playerid,"Adminlevel")>=rang)return 1;
return 0;
}
Hier, musst dann eben noch die Adminnamen und die Dialog-ID anpassen..
static const Adminname[][] = {"User","Supporter","Administrator","High Administrator","Projektleiter"}; //Anpassen
#define dAdmins 500 //Anpassen
ocmd:admins(playerid){
new str[512],buffer[64],p_name[MAX_PLAYER_NAME];
for(new i = 0; i<max_players; i++){
if(!IsPlayerConnected(i))continue;
if(GetPVarInt(playerid,"Adminlevel") <= 0)continue;
GetPlayerName(i,p_name,MAX_PLAYER_NAME);
format(buffer,sizeof(buffer),"'%s' %s%c",Adminname[GetPVarInt(i,"Adminlevel")],p_name,(i == MAX_PLAYERS) ? '\0' : '\n'),strins(str,buffer,strlen(str),sizeof(str));
}
if(strlen(str))return ShowPlayerDialog(playerid,dAdmins,DIALOG_STYLE_MSGBOX,"Admins online",str,"Okay","");
else return ShowPlayerDialog(playerid,dAdmins,DIALOG_STYLE_MSGBOX,"Admins online","Zur Zeit sind keine Admins online!","Okay","");
}
//Edit: Bearbeitet
Alles anzeigenHier, musst dann eben noch die Adminnamen und die Dialog-ID anpassen..
static const Adminname[][] = {"User","Supporter","Administrator","High Administrator","Projektleiter"}; //Anpassen
#define dAdmins 500 //Anpassen
ocmd:admins(playerid){
new str[512],buffer[64],p_name[MAX_PLAYER_NAME];
for(new i = 0; i<max_players; i++){
if(!IsPlayerConnected(i))continue;
if(GetPVarInt(playerid,"Adminlevel") <= 0)continue;
GetPlayerName(i,p_name,MAX_PLAYER_NAME);
format(buffer,sizeof(buffer),"'%s' %s%c",Adminname[GetPVarInt(i,"Adminlevel")],p_name,(i == MAX_PLAYERS) ? '\0' : '\n'),strins(str,buffer,strlen(str),sizeof(str));
}
if(strlen(str))return ShowPlayerDialog(playerid,dAdmins,DIALOG_STYLE_MSGBOX,"Admins online",str,"Okay","");
else return ShowPlayerDialog(playerid,dAdmins,DIALOG_STYLE_MSGBOX,"Admins online","Zur Zeit sind keine Admins online!","Okay","");
}
//Edit: Bearbeitet
: error 017: undefined symbol "max_players"
ocmd:admins(playerid,params[])
{
for(new i = 0;i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new Alevel;
if(isPlayerAnAdmin(i,Alevel))
{
new name[MAX_PLAYER_NAME];
new string[48];
GetPlayerName(i,name,sizeof(name));
format(string, sizeof(string), "Admin: %s", name);
SendClientMessage(playerid,COLOR_GREY,"Admins Online:");
SendClientMessage(playerid,COLOR_GREY,string);
}
}
}
return 1;
}
error 017: undefined symbol "max_players"
Schreib das max_players einfach groß, dann gehts