[Sammelthread] Meine Werke

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
  • Also


    Da ich immer wieder paar sachen scripte, die ihr vllt auch gebrauchen könntet poste ich sie hier..



    GamerAdmin:

    Spoiler anzeigen

    #include <a_samp>
    #include <dini>
    #include <dudb>
    #define COLOR_GREY 0xAFAFAFAA
    #define COLOR_GREEN 0x9EC73DAA
    #define Grau 0x00FF00FF
    #define rot 0xAA3333AA
    #define COLOR_LIGHTRED 0xFF6347AA
    #define hellblau 0x33CCFFAA
    #define COLOR_LIGHTGREEN 0x9ACD32AA
    #define COLOR_YELLOW 0xDABB3EAA
    #define Gelb 0xDABB3EAA
    #define COLOR_WHITE 0xFFFFFFAA
    #define COLOR_PURPLE 0xC2A2DAAA
    #define blau 0x2641FEAA
    #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
    #pragma tabsize 0
    #define LEVEL1 "Level 1:/healme , /goto [ID]"
    #define LEVEL2 "Level 2: /kick [ID] [Grund] ,/healall ,"
    #define LEVEL3 "Level 3: /ban [ID] [Grund] ,"
    #define LEVEL4 "Level 4: /killall ,"
    #define LEVEL5 "Level 5: /mgadmin [ID] [LEVEL] ,/kickall "
    #define KEINADMIN "Du bist kein Admin!"
    #define KEINADMIN1 "Du bist kein Admin Level 1!"
    #define KEINADMIN2 "Du bist kein Admin Level 2!"
    #define KEINADMIN3 "Du bist kein Admin Level 3!"
    #define KEINADMIN4 "Du bist kein Admin Level 4!"
    #define KEINADMIN5 "Du bist kein Admin Level 5!"
    enum sInfo
    {
    score,
    cash,
    admin,
    team,
    }
    new UpdateTimer;
    new SpielerInfo[MAX_PLAYERS][sInfo];
    new Eingeloggt[MAX_PLAYERS];
    new Team[MAX_PLAYERS];

    Spoiler anzeigen
    public OnPlayerConnect(playerid)
    {
    new string[256];
    new Spieler[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Spieler, sizeof(Spieler));
    format(string, sizeof(string), "%s.gameradmin", Spieler);
    Eingeloggt[playerid] = 0;
    SendClientMessage(playerid, rot, " Willkommen, Dieser Server benutzt GamerAdmin.");
    SendClientMessage(playerid, rot, " Bitte beachte /admins !");
    if (dini_Exists(string)) {
    SendClientMessage(playerid, rot, " Bitte logge dich ein: /login [Password]");
    }else{
    SendClientMessage(playerid, rot, " Bitte registriere dich: /register [Password]"); }
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerDisconnect(playerid)
    {
    new string[256];
    new Spieler[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Spieler, sizeof(Spieler));
    format(string, sizeof(string), "%s.gameradmin", Spieler);
    dini_IntSet(string, "score", GetPlayerScore(playerid));
    dini_IntSet(string, "cash", GetPlayerMoney(playerid));
    dini_IntSet(string, "admin", SpielerInfo[playerid][admin]);
    dini_IntSet(string, "team", GetPlayerTeam(playerid));
    Eingeloggt[playerid] = 0;
    KillTimer(UpdateTimer);
    return 1;
    }

    Spoiler anzeigen
    dcmd_kickall(playerid,params[])
    {
    #pragma unused params
    if(SpielerInfo[playerid][admin]>=5 || IsPlayerAdmin(playerid)) {
    SendClientMessageToAll(rot,"Alle wurden vom Server gekickt.");
    for(new i =0; i < MAX_PLAYERS;i++) {
    Kick(i);
    }
    }
    else {
    SendClientMessage(playerid,rot,KEINADMIN);//thx an Goldkiller
    return 1;
    }
    return 1;
    }

    Spoiler anzeigen
    dcmd_admins(playerid,params[])
    {
    #pragma unused params
    SendClientMessage(playerid, rot, "***Admins Online:");
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++) {
    if(IsPlayerConnected(i)) {
    if(SpielerInfo[i][admin] > 0|| IsPlayerAdmin(i)) {
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 128, " %s (Level:%d)", sendername,SpielerInfo[i][admin]);
    SendClientMessage(playerid, rot, string);
    }}}
    return 1;
    }

    Spoiler anzeigen
    dcmd_goto(playerid,params[]) {
    if(SpielerInfo[playerid][admin]>=1 || IsPlayerAdmin(playerid)) {
    new typ = strval(strget(params, 1));
    if(IsPlayerConnected(typ)) {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(typ,x,y,z);
    SetPlayerPos(playerid,x,y,z);
    SetPlayerInterior(playerid,GetPlayerInterior(typ));
    }else{
    SendClientMessage(playerid,rot,"ID nicht vergeben"); }
    return 1;}
    else { SendClientMessage(playerid,rot,KEINADMIN);}
    return 1;}

    Spoiler anzeigen
    dcmd_healme(playerid,params[]) {
    #pragma unused params
    if(SpielerInfo[playerid][admin]>=1 || IsPlayerAdmin(playerid)) {
    SetPlayerHealth(playerid,100);}
    else { SendClientMessage(playerid,rot,KEINADMIN);}
    return 1;}

  • Rest:

    Spoiler anzeigen

    dcmd_healall(playerid,params[]) {
    new string[128];
    #pragma unused params
    if(SpielerInfo[playerid][admin]>=2 || IsPlayerAdmin(playerid)) {
    for(new i = 0; i <= MAX_PLAYERS; i++) {
    SetPlayerHealth(i,100);}
    new Text[32];
    new SpielerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,SpielerName,sizeof(SpielerName));
    format(Text,sizeof(Text),"%s hat alle geheilt!",SpielerName);
    SendClientMessageToAll(rot,Text);
    format(string,sizeof(string),"Admin: %s Hat alle geheilt!",admin);}
    else { SendClientMessage(playerid,rot,KEINADMIN);}
    return 1;}

    Spoiler anzeigen
    dcmd_killall(playerid,params[]) {
    new string[128];
    #pragma unused params
    if(SpielerInfo[playerid][admin]>=4 || IsPlayerAdmin(playerid)) {
    for(new i = 0; i <= MAX_PLAYERS; i++) {
    SetPlayerHealth(i,0);}
    new Text[32];
    SendClientMessageToAll(rot,Text);
    format(string,sizeof(string),"Admin: %s Hat alle gekillt!",admin);}
    else { SendClientMessage(playerid,rot,KEINADMIN);}
    return 1;}

    Spoiler anzeigen
    dcmd_ahelp(playerid,params[]) {
    #pragma unused params
    if(SpielerInfo[playerid][admin]>=1 || IsPlayerAdmin(playerid)) {
    SendClientMessage(playerid,blau,LEVEL1);}
    else { SendClientMessage(playerid,rot,KEINADMIN1);}
    if(SpielerInfo[playerid][admin]>=2 || IsPlayerAdmin(playerid)) {
    SendClientMessage(playerid,blau,LEVEL2);}
    else { SendClientMessage(playerid,rot,KEINADMIN2);}
    if(SpielerInfo[playerid][admin]>=3 || IsPlayerAdmin(playerid)) {
    SendClientMessage(playerid,blau,LEVEL3);}
    else { SendClientMessage(playerid,rot,KEINADMIN3);}
    if(SpielerInfo[playerid][admin]>=4 || IsPlayerAdmin(playerid)) {
    SendClientMessage(playerid,blau,LEVEL4);}
    else { SendClientMessage(playerid,rot,KEINADMIN4);}
    if(SpielerInfo[playerid][admin]>=5 || IsPlayerAdmin(playerid)) {
    SendClientMessage(playerid,blau,LEVEL5);}
    else { SendClientMessage(playerid,rot,KEINADMIN5);}
    return 1;}

    Spoiler anzeigen
    dcmd_kick(playerid,params[]) {//by tut
    if(SpielerInfo[playerid][admin]>=2 || IsPlayerAdmin(playerid)) {
    new
    sGrund[128],
    pID;
    if(sscanf(params, "dz",pID,sGrund)) {
    return SendClientMessage(playerid,rot,"USAGE: /kick [playerid] ([grund],optional)");
    }
    if(!IsPlayerConnected(pID)) {
    return SendClientMessage(playerid,rot,"Kein Spieler mit angegebener ID Online");
    }
    new
    ThePlayer[MAX_PLAYER_NAME],
    string[128];
    GetPlayerName(pID,ThePlayer,sizeof(ThePlayer));
    format(string,sizeof(string),"%s (ID %d) wurde vom Server gekickt,Grund: %s",ThePlayer,pID,sGrund[0] ? sGrund : "<Kein Grund>");
    SendClientMessageToAll(COLOR_YELLOW,string);
    Kick(pID);
    } else { SendClientMessage(playerid,rot,KEINADMIN); }
    return 1;
    }

    Spoiler anzeigen
    dcmd_ban(playerid,params[]) {// by tut
    if(SpielerInfo[playerid][admin]>=3 || IsPlayerAdmin(playerid)) {
    new
    sGrund[128],
    pID;
    if(sscanf(params, "dz",pID,sGrund)) {
    return SendClientMessage(playerid,rot,"USAGE: /ban [playerid] ([grund],optional)");
    }
    if(!IsPlayerConnected(pID)) {
    return SendClientMessage(playerid,rot,"Kein Spieler mit angegebener ID Online");
    }
    new
    ThePlayer[MAX_PLAYER_NAME],
    string[128];
    GetPlayerName(pID,ThePlayer,sizeof(ThePlayer));
    format(string,sizeof(string),"%s (ID %d) wurde vom Server gebant,Grund: %s",ThePlayer,pID,sGrund[0] ? sGrund : "<Kein Grund>");
    SendClientMessageToAll(COLOR_YELLOW,string);
    Ban(pID);
    } else { SendClientMessage(playerid,rot,KEINADMIN); }
    return 1;
    }

    Spoiler anzeigen
    dcmd_mgadmin(playerid,params[]) {
    if(SpielerInfo[playerid][admin]>=5 || IsPlayerAdmin(playerid)) {
    if(!strlen(params)) return SendClientMessage(playerid,rot,"/mgadmin ID LEVEL");
    new typ = strval(strget(params,0));
    if(IsPlayerConnected(typ)) {
    if(!strlen(strget(params,1))) return SendClientMessage(playerid,rot,"/mgadmin ID LEVEL");
    new adminlvl = strval(strget(params,1));
    if(adminlvl>=0 && adminlvl<=5) {
    new s[100], name[16];
    GetPlayerName(typ,name,sizeof(name));
    format(s,sizeof(s),"Du hast %s zum Admin Level %d gemacht",name,adminlvl);
    SendClientMessage(playerid,blau,s);
    GetPlayerName(playerid,name,sizeof(name));
    format(s,sizeof(s),"%s hat dich zum Admin Level %d gemacht",name,adminlvl);
    SendClientMessage(typ,blau,s); SpielerInfo[typ][admin] = adminlvl; }
    else { SendClientMessage(playerid,rot,"Inkorrektes Level"); }}
    else { SendClientMessage(playerid,rot,"ID nicht vergeben"); }}
    else { SendClientMessage(playerid,rot,"Dein Admin Level ist nich hoch genung"); }
    return 1;
    }

    Spoiler anzeigen
    dcmd_register(playerid, params[])
    {
    if (IsPlayerConnected(playerid)){
    new string[21];
    new Spieler[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Spieler, sizeof(Spieler));
    format(string, sizeof(string), "%s.gameradmin", Spieler);
    if(!strlen(params)){
    return SendClientMessage(playerid, 0xffffff, " /register [Password]");
    }
    if (dini_Exists(string))
    {
    return SendClientMessage(playerid, 0xffffff, " Der name ist bereits registriert");
    }
    else
    {
    dini_Create(string);
    dini_IntSet(string, "password",udb_hash(params));
    dini_IntSet(string, "score", 0);
    dini_IntSet(string, "cash", 0);
    dini_IntSet(string, "admin", 0);
    dini_IntSet(string, "team", 0);
    SendClientMessage(playerid, 0xffffff, " Bitte einloggen: /login [Password]");
    }
    }
    return 1;
    }

    Spoiler anzeigen
    dcmd_login(playerid, params[])
    {
    if (IsPlayerConnected(playerid))
    {
    new string[21];
    new Spieler[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Spieler, sizeof(Spieler));
    format(string, sizeof(string), "%s.gameradmin", Spieler);
    if(!strlen(params))
    {
    return SendClientMessage(playerid, 0xffffff, " /register [Password]");
    }
    if (dini_Exists(string))
    {
    if(udb_hash(params)!=strval(dini_Get(string,"password")))
    {
    return SendClientMessage(playerid, 0xffffff, " Falsches password");
    }
    Eingeloggt[playerid] = 1;
    SpielerInfo[playerid][score] = dini_Int(string, "score");
    SpielerInfo[playerid][cash] = dini_Int(string, "cash");
    SpielerInfo[playerid][admin] = dini_Int(string, "admin");
    Team[playerid] = dini_Int(string, "team");
    ResetPlayerMoney(playerid);
    SetPlayerScore(playerid,0);
    GivePlayerMoney(playerid, SpielerInfo[playerid][cash]);
    SetPlayerScore(playerid, SpielerInfo[playerid][score])
    ; SendClientMessage(playerid,0xffffff,"Erfolgreich eingeloggt");
    }
    }
    return 1;
    }

    Spoiler anzeigen
    stock sscanf(string[], format[], {Float,_}:...)
    {

    Spoiler anzeigen
    #if defined isnull
    if (isnull(string))
    #else
    if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
    #endif
    {
    return format[0]; }
    #pragma tabsize 4
    new
    formatPos = 0,
    stringPos = 0,
    paramPos = 2,
    paramCount = numargs(),
    delim = ' ';
    while (string[stringPos] && string[stringPos] <= ' ') {
    stringPos++; }
    while (paramPos < paramCount && string[stringPos]) {
    switch (format[formatPos++]) {
    case '\0': {
    return 0; }
    case 'i', 'd': {
    new
    neg = 1,
    num = 0,
    ch = string[stringPos];
    if (ch == '-') {
    neg = -1;
    ch = string[++stringPos]; }
    do {
    stringPos++;
    if ('0' <= ch <= '9') {
    num = (num * 10) + (ch - '0'); }
    else {
    return -1; } }
    while ((ch = string[stringPos]) > ' ' && ch != delim);
    setarg(paramPos, 0, num * neg); }
    case 'h', 'x': {
    new
    num = 0,
    ch = string[stringPos];
    #pragma tabsize 0
    do {
    stringPos++;
    switch (ch) {
    case 'x', 'X': {
    num = 0;
    continue; }
    case '0' .. '9': {
    num = (num << 4) | (ch - '0'); }
    case 'a' .. 'f': {
    num = (num << 4) | (ch - ('a' - 10)); }
    case 'A' .. 'F': {
    num = (num << 4) | (ch - ('A' - 10)); }
    default: {
    return -1; }}}
    while ((ch = string[stringPos]) > ' ' && ch != delim);
    setarg(paramPos, 0, num);}
    case 'c': {
    setarg(paramPos, 0, string[stringPos++]); }
    case 'f': {
    setarg(paramPos, 0, _:floatstr(string[stringPos])); }
    case 'p': {
    delim = format[formatPos++];
    continue; }
    case '\'': {
    new
    end = formatPos - 1,
    ch;
    while ((ch = format[++end]) && ch != '\'') {}
    if (!ch) {
    return -1; }
    format[end] = '\0';
    if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1) {
    if (format[end + 1]) {
    return -1; }
    return 0; }
    format[end] = '\'';
    stringPos = ch + (end - formatPos);
    formatPos = end + 1; }
    case 'u': {
    new
    end = stringPos - 1,
    id = 0,
    bool:num = true,
    ch;
    while ((ch = string[++end]) && ch != delim) {
    if (num) {
    if ('0' <= ch <= '9') {
    id = (id * 10) + (ch - '0'); }
    else {
    num = false; }}}
    if (num && IsPlayerConnected(id)) {
    setarg(paramPos, 0, id); }
    else {
    #if !defined foreach
    #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
    #define __SSCANF_FOREACH__
    #endif
    string[end] = '\0';
    num = false;
    new
    name[MAX_PLAYER_NAME];
    id = end - stringPos;
    foreach (Player, playerid) {
    GetPlayerName(playerid, name, sizeof (name));
    if (!strcmp(name, string[stringPos], true, id)) {
    setarg(paramPos, 0, playerid);
    num = true;
    break; }}
    if (!num){
    setarg(paramPos, 0, INVALID_PLAYER_ID);}
    string[end] = ch;
    #if defined __SSCANF_FOREACH__
    #undef foreach
    #undef __SSCANF_FOREACH__
    #endif
    }
    stringPos = end; }
    case 's', 'z': {
    new
    i = 0,
    ch;
    if (format[formatPos]) {
    while ((ch = string[stringPos++]) && ch != delim) {
    setarg(paramPos, i++, ch); }
    if (!i) {
    return -1; }} else {
    while ((ch = string[stringPos++])) {
    setarg(paramPos, i++, ch); } }
    stringPos--;
    setarg(paramPos, i, '\0'); }
    default: {

    Spoiler anzeigen
    #pragma tabsize 0
    continue; } }
    while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ') {
    stringPos++; }
    while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' ')) {
    stringPos++; }
    paramPos++; }
    do
    {
    if ((delim = format[formatPos++]) > ' '){
    if (delim == '\''){
    while ((delim = format[formatPos++]) && delim != '\'') {}}
    else if (delim != 'z'){
    return delim;}}}
    while (delim > ' ');
    return 0;}

    Spoiler anzeigen
    stock strget(strx[], pos, search = ' ') {
    new arg, ret[128], idxx;
    for (new i = 0; i < strlen(strx); i++) {
    if(strx[i] == search || i == strlen(strx) || strx[i + 1] == 10) {
    arg++;
    if (arg == pos + 1){
    ret[i-idxx] = EOS;
    return ret;
    } else if (arg == pos)
    idxx= i+1;
    }
    else if (arg == pos)
    ret[i - idxx] = strx[i];
    }
    return ret;
    }


    GameStreamer[Object Streamer]
    http://gamer.pastebin.com/f7931c129

    Einmal editiert, zuletzt von ]PRT[The_Gamer ()