Beiträge von DMA

    enum P_TEAM { SWAT, SUSPECTS };
    new P_TEAM:pTeam[MAX_PLAYERS];
    /* ... */
    if(text[0] == '!')
    {
    SendTeamMessage(text, pTeam[playerid]);
    return 0;
    }
    /* ... */
    stock SendTeamMessage(arg1[], P_TEAM:arg2)
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(pTeam[i] == arg2)
    SendClientMessage(i, 0xFF6900AA, arg1);
    }
    }

    Sebihunter lern a) Scripten und b) Einrücken.
    Meine Lösung:
    #define FILE_END ".txt"


    public CheckVehicle(playerid)
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    new vehicle = GetPlayerVehicleID(playerid);
    new Float:vHealth;
    GetVehicleHealth(vehicle, vHealth);
    if(vHealth >= 0 && vHealth < 300)
    {
    SendClientMessage(playerid,COLOR_RED,"Dein Wagen hat eine Autopanne");
    TogglePlayerControllable(playerid,0);
    KillTimer(Vehicle[playerid]);


    if(IsPlayerInAnyVehicle(playerid)){
    new string[256];
    format(string, 255, "%d%s", vehicle, FILE_END);
    if(fexist(string))
    {
    new File:fstream = fopen(string, io_write);
    fwrite(fstream, "panne=1");
    fclose(fstream);
    }
    }
    for(new i=0;i<MAX_PLAYERS;i++)
    {
    if(IsPlayerConnected(i))
    {
    PlayerPlaySoundEx(i,1140);
    PlayerPlaySoundEx(i,1134);
    }
    }
    return 1;
    }
    }
    return 1;
    }

    Simples Admin System.
    Inzeile 5 wird das Admin PW fest gelegt.
    Mit (/alogin eingabe pw eingabe) logst du dich ein ;)
    /* (c) by DMA 2008
    SA:MP & PAWN */
    #define slots 35
    /* admin PW */
    #define ADMIN_PW "jumbo12!"
    #include <a_samp>
    enum Real { NO, YES };
    static Real:admin[slots], Real:want_login[slots];


    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" AdmiN FS (c) DMA 2008");
    print("--------------------------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    public OnPlayerConnect(playerid)
    {
    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    want_login[playerid] = NO;
    admin[playerid] = NO;
    return 1;
    }


    public OnPlayerText(playerid, text[])
    {
    if(want_login[playerid] == YES)
    {
    want_login[playerid] = NO;
    if(!strcmp(text, ADMIN_PW))
    {
    admin[playerid] = YES;
    SendClientMessage(playerid, 0xFF6900AA, "Login As A Admin");
    }
    else
    SendClientMessage(playerid, 0xFF6900AA, "Falsches Passwort");
    return 0;
    }
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(!strcmp(cmdtext, "/alogin"))
    {
    want_login[playerid] = YES;
    return 1;
    }
    if(admin[playerid] == YES)
    {
    if(!strcmp(cmdtext, "/kick", false, 5))
    {
    new kickid = strval(getstrspc(cmdtext, 1));
    Kick(kickid);
    SendClientMessage(playerid, 0xFF0000AA, "Erfolgreich gekickt!");
    }
    }
    return 0;
    }


    stock getstrspc(string[], argument) /* Native Cypog */
    {
    new length = strlen(string), arg, result[30], index;
    for (new i = 0; i < length; i++)
    {
    if (string[i] == ' ' || i == length || string[i + 1] == 10)
    {
    arg++;
    if (arg == argument + 1)
    {
    result[i-index] = EOS;
    return result;
    }
    else if (arg == argument)
    index = i+1;
    }
    else if (arg == argument)
    result[i - index] = string[i];
    }
    return result;
    }


    Falls du eine File.IO einfügen möchtest , frag mich ich baus aus ;x

    Geht nicht:

    Code
    D:\Programme\samp-server\gamemodes\gae.pwn(132) : error 035: argument type mismatch (argument 2)


    if(!strcmp(cmdtext, "/test")) {
    GivePlayerMoney(playerid, cmdtext);
    }
    Geht:
    if(!strcmp(cmdtext, "/test")) {
    GivePlayerMoney(playerid, strval(cmdtext));
    }
    Deine Lösung die natürlich nicht geht:

    dcmd_abc(playerid, blabla[])
    {
    GivePlayerMoney(playerid, blabla);
    return 1; }

    Ach und erklär mir wie das Funktionier söllte:
    char *x = "H3llo";
    printf("Die zweite Stelle von Hello ist eine Zahl: %d", x[1]);
    Tja Compiler Programm crash :p

    Aha String in einem Integer.
    Entweder casten oder Conventieren.
    if(!strcmp(cmdtext, "/money", true))
    {
    if(cmdtext[7] > 0) GivePlayerMoney(playerid, strval(cmdtext[7]));
    return 1;
    }

    @Raf es geht ;x. Nur hat sich keiner die Mühe gemacht, die md5 strings vom SA:MP Server zu entschlüsseln.
    Ansonsten könnte man den RAW-Code einfach Interpretieren und nicht erst durch die VM ziehen.

    Das geht nicht, Spawn diese doch einfach und Link sie.
    Lösung:#define VEHICLE_SPAWN_INT 6
    @OnVehicleSpawn(vehicleid)
    {
    LinkVehicleToInterior(vehicleid, VEHICLE_SPAWN_INT);
    }


    #define admin_class_id() 3
    new bool:playerAllowToSpawn[MAX_PLAYERS];
    /* ... */
    switch(classid) {
    case admin_class_id(): {
    if(IsPlayerAdmin(playerid)) playerAllowToSpawn[playerid] = true;
    else playerAllowToSpawn[playerid] = false;
    break;
    } default: playerAllowToSpawn[playerid] = true;
    }
    /* ... OnPlayerSpawn ... */
    if(playerAllowToSpawn[playerid] != true)
    ForcePlayerToClassSection(playerid);