Admin System

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hi Leute,
    Ich will euch mal mein Admin filterscripts geben schaut es euch einfach an bei Fragen oder Anregungen einfach bescheit sagen.
    Ihr braucht zusätzlich noch das include ocmd,dini,sscanf

    stock isPlayerAnAdmin(playerid,rang)
    {
    if(GetPVarInt(playerid,"Adminlevel")>=rang)return 1;
    return 0;
    }
    ocmd:setadmin(playerid,params[])
    {
    if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
    new pID, rank;
    if(sscanf(params,"ui",pID,rank))return SendClientMessage(playerid,ROT,"/setadmin [id] [lvl]");
    if(rank<1||rank>5)return SendClientMessage(playerid,ROT,"The rank don't exists");
    SetPVarInt(pID,"Adminlevel",rank);
    SpielerSpeichern(pID);
    SendClientMessageToAll(BLAU,"A player is now an admin");
    return 1;
    }
    ocmd:ann(playerid,params[])
    {
    new text, string[128 + MAX_PLAYER_NAME];
    if(!isPlayerAnAdmin(playerid,1))return SendClientMessage(playerid,ROT,"You must be an admin lvl 1!");


    if(sscanf(params,"s",text))return SendClientMessage(playerid,ROT,"Using: /ann [text]");
    format(string, sizeof(string), "%s",text);
    GameTextForAll(string,5000,6);


    return 1;
    }
    ocmd:goto(playerid,params[])
    {
    if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
    new pID;
    if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/goto [id]");
    if(!IsPlayerConnected(playerid))return SendClientMessage(playerid,ROT,"The player has not connected!");
    new string[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(string,sizeof(string),"The admin %s teleported to you",name);
    new string1[128];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(pID,pname,sizeof(pname));
    format(string1,sizeof(string1),"You've teleported to %s",pname);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(pID,x,y,z);
    SetPlayerPos(playerid,x+2,y,z);

    return 1;
    }
    ocmd:jail(playerid,params[])
    {
    if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
    new pID;
    if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/goto [id]");
    if(!IsPlayerConnected(playerid))return SendClientMessage(playerid,ROT,"The player has not connected!");
    new string[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(string,sizeof(string),"The admin %s jailed you",name);
    new string1[128];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(pID,pname,sizeof(pname));
    format(string1,sizeof(string1),"You've jailed %s",pname);
    SetPVarInt(playerid,"jailed",1);
    SetPlayerInterior(pID, 3);
    SetPlayerPos(pID, 197.6661, 173.8179, 1003.0234);
    return 1;
    }
    ocmd:unjail(playerid,params[])
    {
    if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
    new pID;
    if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/goto [id]");
    if(!IsPlayerConnected(playerid))return SendClientMessage(playerid,ROT,"The player has not connected!");
    new string[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(string,sizeof(string),"The admin %s unjailed you",name);
    new string1[128];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(pID,pname,sizeof(pname));
    format(string1,sizeof(string1),"You've unjailed %s",pname);
    SetPVarInt(playerid,"jailed",0);
    SetPlayerInterior(pID,0);
    SetPlayerPos(pID, -62.1489,-1117.5663,1.0781);
    return 1;
    }


    ocmd:warn(playerid,params[])
    {
    if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,BLAU,"Du musst admin lvl 2 sein !");
    new string1[128],pID,pname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME],text[128],string2[128];
    if(sscanf(params,"us",pID,text))return SendClientMessage(playerid,ROT,"Usage:/warn [id] [reason]");
    GetPlayerName(playerid,name,sizeof(name));
    GetPlayerName(pID,pname,sizeof(pname));
    SetPVarInt(pID,"warn",GetPVarInt(pID,"warn") + 1);
    SpielerSpeichern(pID);
    format(string1,sizeof(string1),"Admin %s warned %s reason: %s",name,pname,text);
    format(string2,sizeof(string2),"Admin %s warned you reason : %s",name,text);
    GameTextForPlayer(playerid,string2,10000,5);
    SendClientMessageToAll(BLAU,string1);
    SetTimer("warns",5000,0);
    if(GetPVarInt(pID,"warn")>= 3)
    {
    SetPVarInt(pID,"warn",0);
    SpielerSpeichern(pID);
    SendClientMessage(pID,ROT,"You got 3 warnings and be kicked!");
    Kick(pID);
    }
    return 1;
    }


    ocmd:gethere(playerid,params[])
    {
    if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
    new pID;

    if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/gethere [id]");
    if(!IsPlayerConnected(playerid))return SendClientMessage(playerid,ROT,"The player has not connected!");
    new string[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(string,sizeof(string),"You've been teleported to %s",name);
    new string1[128];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(pID,pname,sizeof(pname));
    format(string1,sizeof(string1),"You've get %s to you",pname);
    SendClientMessage(playerid,BLAU,string1);
    SendClientMessage(pID,BLAU,string);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(pID,x+2,y,z);

    return 1;
    }
    stock adminschleife(string1[128],rang)
    {


    for(new i=0; i<GetMaxPlayers(); i++)
    {
    if(isPlayerAnAdmin(i,rang))
    {
    SendClientMessage(i,BLAU,string1);

    }
    }


    return 1;
    }
    stock SendAdminMessage(rang,color,message[])
    {
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    if(isPlayerAnAdmin(i,rang))
    {
    SendClientMessage(i,color,message);
    }
    }
    return 1;
    }
    ocmd:smta(playerid,params[])
    {
    if(GetPVarInt(playerid,"jailed")== 1)return SendClientMessage(playerid,ROT,"You can't use commands if you're jailed!");
    {
    new text[MAX_PLAYER_NAME];
    if(sscanf(params,"s",text))return SendClientMessage(playerid,ROT,"/smta [text]");
    new string1[128];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string1,sizeof(string1),"Admin Message recieved from %s.Text:%s",pname,text);
    SendAdminMessage(1,ROT,string1);
    }
    return 1;
    }
    ocmd:report(playerid,params[])
    {
    if(GetPVarInt(playerid,"jailed")== 1)return SendClientMessage(playerid,ROT,"You can't use commands if you're jailed!");
    {
    new pID, text[MAX_PLAYER_NAME];
    if(sscanf(params,"us",pID,text))return SendClientMessage(playerid,ROT,"/report [id] [text]");
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,sizeof(pname));
    new name[MAX_PLAYER_NAME];
    GetPlayerName(pID,name,sizeof(name));
    new string1[128];
    format(string1,sizeof(string1),"%s reported %s with the text : %s",pname,name,text);
    adminschleife(string1,1);
    }
    return 1;
    }
    ocmd:slap(playerid,params[])
    {
    if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
    new pID;


    if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/slap [id]");
    if(!IsPlayerConnected(pID))return SendClientMessage(playerid,ROT,"The player has not connected!");
    new string[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(string,sizeof(string),"You've been teleported to %s",name);
    new string1[128];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(pID,pname,sizeof(pname));
    format(string1,sizeof(string1),"You've get %s to you",pname);
    SendClientMessage(playerid,BLAU,string1);
    SendClientMessage(pID,BLAU,string);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    SetPlayerPos(pID,x+2,y,z+100);
    return 1;
    }
    ocmd:ban(playerid,params[])
    {
    if(!isPlayerAnAdmin(playerid,4))return SendClientMessage(playerid,ROT,"You are not admin lvl 4");
    new pID, reason[128],string[128];
    if(sscanf(params,"us",pID,reason))return SendClientMessage(playerid,BLAU,"/ban [id] [reason]");
    format(string,sizeof(string),"AdmCmd: %s has benn banned from admin %s. Reason: %s",SpielerName(pID),SpielerName(playerid),reason);
    SendClientMessageToAll(ROT,string);
    SetPVarInt(pID,"Baned",1);
    Kick(pID);
    return 1;
    }
    ocmd:kick(playerid,params[])
    {
    if(!isPlayerAnAdmin(playerid,1))return SendClientMessage(playerid,ROT,"You are not admin lvl 1");
    new pID, reason[128],string[128];
    if(sscanf(params,"us",pID,reason))return SendClientMessage(playerid,BLAU,"/kick [id] [reason]");
    format(string,sizeof(string),"AdmCmd: %s has been kicked from admin %s Reason: %s",SpielerName(pID),SpielerName(playerid),reason);
    SendClientMessageToAll(ROT,string);
    Kick(pID);
    return 1;
    }


    ocmd:unfreeze(playerid,params[])
    {
    new pid;
    if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"You are not admin lvl 2!");
    if(sscanf(params,"u",pid)) return SendClientMessage(playerid,BLAU,"Using:/freeze [ID]");
    if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"You are not admin lvl 2!");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid,BLAU,"This player don't connected!");


    if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"You are not admin lvl 3!");
    TogglePlayerControllable(pid,1);
    SendClientMessage(pid,BLAU,"You are beeing unfreezed");
    SendClientMessage(playerid,BLAU,"You unfreezd the player");
    return 1;
    }


    ocmd:giveweapon(playerid,params[])
    {
    new pID,
    string[128],
    string2[128],
    weapon,
    ammunation;
    if(sscanf(params,"udd",pID,weapon,ammunation)) return SendClientMessage(playerid,ROT,"Using:/giveweapon [ID] [weapon] [Ammunation]");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,ROT,"This player don't connected!");
    if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5!");
    format(string,sizeof(string),"You gave %s a weapon",SpielerName(pID));
    format(string2,sizeof(string2),"You gave from %s a weapon",SpielerName(pID));
    GivePlayerWeapon(pID,weapon,ammunation);
    SendClientMessage(playerid,ROT,string);
    SendClientMessage(pID,ROT,string2);
    return 1;
    }


    ocmd:freeze(playerid,params[])
    {
    new pid;
    if(sscanf(params,"u",pid)) return SendClientMessage(playerid,ROT,"Using:/freeze [ID]");
    if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"You are not admin lvl 2!");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid,ROT,"This player don't conneceted");
    if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"You are not admin lvl 2!");
    TogglePlayerControllable(pid,0);
    SendClientMessage(pid,BLAU,"You've being freezed!");
    SendClientMessage(playerid,BLAU,"You freezed a player");
    return 1;
    }
    ocmd:spawncar(playerid,params[])
    {
    new mid,c1,c2,vehicleid1;
    if(sscanf(params,"ddd",mid,c1,c2)) return SendClientMessage(playerid,ROT,"Using: /spawncar [ModelID] [Color1] [Color2]");
    if(!isPlayerAnAdmin(playerid,1))return SendClientMessage(playerid,ROT,"You are not admin lvl 1!");
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    vehicleid1 = CreateVehicle(mid,x,y,z+10,0,c1,c2,-1);
    PutPlayerInVehicle(playerid,vehicleid1,0);
    SendClientMessage(playerid,BLAU,"You've spawned a car");
    return 1;
    }



    so bei eurem SpielerSpeichern müsst ihr dann noch:

    dini_IntSet(Spielerdatei,"Adminlevel",GetPVarInt(playerid,"Adminlevel"));
    dini_IntSet(Spielerdatei,"warn",GetPVarInt(playerid,"warn"));
    dini_IntSet(Spielerdatei,"Baned",GetPVarInt(playerid,"Baned"));

    bei Spielerladen:

    SetPVarInt(playerid,"jobs",dini_Int(Spielerdatei,"jobs"));
    SetPVarInt(playerid,"Baned",dini_Int(Spielerdatei,"Baned"));
    SetPVarInt(playerid,"Adminlevel",dini_Int(Spielerdatei,"Adminlevel"));

    und bei onplayerceonnect:

    if(GetPVarInt(playerid,"Baned")==1)return Kick(playerid);

    Einmal editiert, zuletzt von Nixon ()

  • Warum PVar?
    Das ist sowas von lahm..


    Zu den Codes muss ich sagen, das du immerhin nicht so unschlau bist und nen stock Spielername zu machen.
    Naja dennoch seh ich darin kein Filterscript eher nur was das man sich kopieren wird

    All in all it's just another brick in the wall

  • Kurz drüber geschaut und direkt nen Fehler gefunden.


    ocmd:unjail(playerid,params[])
    {
    if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
    new pID;
    if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/goto [id]");
    if(!IsPlayerConnected(playerid))return SendClientMessage(playerid,ROT,"The player has not connected!");
    new string[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(string,sizeof(string),"The admin %s unjailed you",name);
    new string1[128];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(pID,pname,sizeof(pname));
    format(string1,sizeof(string1),"You've unjailed %s",pname);
    SetPVarInt(playerid,"jailed",0); // <----- pID muss dahin.
    SetPlayerInterior(pID,0);
    SetPlayerPos(pID, -62.1489,-1117.5663,1.0781);
    return 1;
    }



  • Alles in Englisch hmm?:


    Meiner Meinung Copy & Paste ausm Godfather oder so:


    0/10 Copy und Paste.


    MfG
    Geronimo

  • alles english weil ich einen Englishen server mache der nichts mit Godfather oder reallife zu tun hat sondern Trucking server,
    also denkt erstmal nach.


    Kann ich auch machen weist du, ich renn ins Englische Forum und kopier mir (oder ausm Godfather) deinen Code und sag das habe ich gescripted haha.



    MfG
    Geronimo

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen

  • Da warst du ja echt präzise was ist denn der fehler

    Hab ich doch mit der Kommentar Zeile markiert..? Hab sogar noch einen gefunden :)


  • Ich mache einen Internationalen professionellen Trucking - Server . Da er International ist , die Weltsprache English ist und so die meisten Leute verstehen heißt es nicht das ich ein Engländer bin. Ich habe lediglich den server auf English gescriptet. Ich weise alle Vorwürfe von Kopien eines Godfather scripts zurück.
    Es ist eure Entscheidung was ihr glaubt, aber dieser Script ist ein Selfmade script und wurde von mir verfasst. Außerdem wenn ihr meine Ip sehen könnt wüsstet ihr das meine Ip Deutsch ist:
    89.0.21.166
    //Edit Außerdem habe ich 4 DEUTSCHE Tutorials gemacht, die ihr euch ansehen könnt:
    http://www.youtube.com/channel…hC9WZcsm3dsw?feature=mhee

  • ich habe auch ein paar Sinnlose sachen gefunden.


    machmal fragt er 2x das Adminlevel ab


    Das liegt daran dass ich dieses Admin system vor längere Zeit angefertigt habe und da noch garnicht erfahren war und habe es dann aus Sicherheitsgründen mit zwei Abfragen gesichert.
    //Edit außerdem wenn ihr euch mein ganzes Filterscript angeguckt hättet, hättet ihr folgendes geshen:
    stock adminschleife(string1[128],rang)
    {


    for(new i=0; i<GetMaxPlayers(); i++)
    {
    if(isPlayerAnAdmin(i,rang))
    {
    SendClientMessage(i,BLAU,string1);

    }
    }


    return 1;
    }
    und ich denke nicht , dass der Begriff AdminSchleife English ist außerdem zu den Beschuldigungen, dass es aus einen Godfather wäre, habe ich zu sagen ob ihr mir genau das zeigen könnt von einem Godfather. Ich denke nicht. :thumbup:

    Einmal editiert, zuletzt von Nixon ()