Beiträge von Kupferhirn

    Problem gelöst
    beim playerdisconnect wurde die playerpos nicht in die variablen gespeichert was ich mit:
    GetPlayerPos(playerid, Spieler[playerid][lastx], Spieler[playerid][lasty], Spieler[playerid][lastz]);
    gelöst habe

    da kommen jetzt diese errors

    Code
    C:\Users\Home\Desktop\samp03asvr_R8_win32\pawno\include\dini.inc(223) : error 017: undefined symbol "adminsystem"
    C:\Users\Home\Desktop\samp03asvr_R8_win32\pawno\include\dini.inc(223) : error 017: undefined symbol "dar"
    C:\Users\Home\Desktop\samp03asvr_R8_win32\pawno\include\dini.inc(223 -- 224) : warning 215: expression has no effect
    C:\Users\Home\Desktop\samp03asvr_R8_win32\pawno\include\dini.inc(224) : error 001: expected token: ";", but found "if"
    C:\Users\Home\Desktop\samp03asvr_R8_win32\pawno\include\dini.inc(224) : fatal error 107: too many error messages on one line

    hier der Code
    [hide]#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 DIALOG_LOGIN 3
    #define DIALOG_REG 4


    enum spieler_daten
    //enum Info //Info ist der name des enums
    {
    passwort[128], // 128 steht für die maximale länge des passworts
    wanted,
    Geld,
    Skin,
    Float:lastx,Float:lasty,Float:lastz,
    eingeloggt,
    AdminLevel,
    }
    new Spieler[MAX_PLAYERS][spieler_daten];


    public OnFilterScriptInit()
    {
    print("--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------");
    return 1;
    }


    public OnPlayerConnect(playerid)
    {
    new pname[MAX_PLAYERS],accFormat[128];
    GetPlayerName(playerid,pname,sizeof pname);
    format(accFormat,sizeof accFormat,"/accounts/%s.ini",pname);
    if(dini_Exists(accFormat))
    {
    ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Login","Abbrechen");
    //GivePlayerMoney(playerid,dini_Int(accFormat,"Geld")); // Hier wird das geld dem Spieler gegeben, was er vorher hatte
    //SetPlayerSkin(playerid,dini_Int(accFormat,"Skin")); // Hier wird der Skin des Spielers geladen
    }
    else
    {
    ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich","OK","Abbrechen");
    }
    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    new pname[MAX_PLAYERS],accFormat[128];
    GetPlayerName(playerid,pname,sizeof pname);
    format(accFormat,sizeof accFormat,"/accounts/%s.ini",pname);
    if(dini_Exists(accFormat))
    {
    dini_IntSet(accFormat,"wanted",Spieler[playerid][wanted]);
    dini_IntSet(accFormat,"Geld",GetPlayerMoney(playerid)); // speichert das aktuelle Geld, was der Spieler zum schluss hatte
    dini_IntSet(accFormat,"Skin",GetPlayerSkin(playerid)); // speichert den aktuellen Skin, welchne der Spieler zum schluss hatte
    dini_FloatSet(accFormat,"lastx",Spieler[playerid][lastx]);
    dini_FloatSet(accFormat,"lasty",Spieler[playerid][lasty]);
    dini_FloatSet(accFormat,"lastz",Spieler[playerid][lastz]);
    dini_IntSet(accFormat,"Score",GetPlayerScore(playerid));
    dini_IntSet(accFormat, "AdminLevel", Spieler[playerid][AdminLevel]);
    print("\n***Speichern erfolgreich***\n");
    }
    return 1;
    }


    public OnPlayerSpawn(playerid)
    {
    new pname[MAX_PLAYERS],accFormat[128];
    GetPlayerName(playerid,pname,sizeof pname);
    format(accFormat,sizeof accFormat,"/accounts/%s.ini",pname);
    if(dini_Isset(accFormat,"lastx"))
    {
    SetPlayerPos(playerid,Spieler[playerid][lastx],Spieler[playerid][lasty],Spieler[playerid][lastz]);
    }
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    new pname[MAX_PLAYERS],accFormat[128];
    GetPlayerName(playerid,pname,sizeof pname);
    format(accFormat,sizeof accFormat,"/accounts/%s.ini",pname);
    if(response)
    {
    switch(dialogid) // dialogid auswählen
    {
    case DIALOG_LOGIN: // ID Login
    {
    if(!strlen(inputtext))
    {
    ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen");
    return SendClientMessage(playerid,0xFFFFFFFF,"Kein Passwort angegeben!");
    }
    if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0)
    {
    Spieler[playerid][wanted] = dini_Int(accFormat,"wanted");
    Spieler[playerid][Skin] = dini_Int(accFormat,"Skin");
    Spieler[playerid][lastx] = dini_Float(accFormat,"lastx");
    Spieler[playerid][lasty] = dini_Float(accFormat,"lasty");
    Spieler[playerid][lastz] = dini_Float(accFormat,"lastz");
    GivePlayerMoney(playerid,dini_Int(accFormat,"Geld"));
    SetPlayerScore(playerid,dini_Int(accFormat,"Score"));
    Spieler[playerid][AdminLevel] = dini_Int(accFormat, "AdminLevel"); // Das Level wird aus der Datei geladen
    Spieler[playerid][eingeloggt] = 1;
    SendClientMessage(playerid,0xFFFFFFFF,"Du wurdest erfolgreich eingeloggt.");
    }
    else
    {
    ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen");
    SendClientMessage(playerid,0xFFFFFFFF,"Das Passwort war Falsch!");
    }
    }
    case DIALOG_REG: // ID Registrieren
    {
    if(!strlen(inputtext)) // Text darf nicht = Null sein Null im Sinne von nichts
    {
    ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich","Weiter","Abbrechen");
    return SendClientMessage(playerid,0xFFFFFFFF,"Das Passwort ist zu kurz!");
    }
    dini_Create(accFormat);
    dini_Set(accFormat,"Passwort",inputtext);
    dini_IntSet(accFormat, "AdminLevel" , 0); // Das Adminlevel auf 0 setzen.
    Spieler[playerid][AdminLevel] = 0;
    Spieler[playerid][eingeloggt] = 1;
    SendClientMessage(playerid,0xFFFFFFFF,"Account wurde angelegt und du wurdest eingeloggt.");
    }
    }
    }
    else
    {
    switch(dialogid)
    {
    case DIALOG_LOGIN:ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte logge dich ein","Weiter","Abbrechen");
    case DIALOG_REG:ShowPlayerDialog(playerid,DIALOG_REG,1,"Registrieren","Bitte Registriere dich","Weiter","Abbrechen");
    }
    }
    return 1;
    }



    /*----------------------------------------------------------------------------*-
    Function:
    sscanf
    Params:
    string[] - String to extract parameters from.
    format[] - Parameter types to get.


    {
    Float,_
    }
    :... - Data return variables.
    Return:
    0 - Successful, not 0 - fail.
    Notes:
    A fail is either insufficient variables to store the data or insufficient
    data for the format string - excess data is disgarded.


    A string in the middle of the input data is extracted as a single word, a
    string at the end of the data collects all remaining text.


    The format codes are:


    c - A character.
    d, i - An integer.
    h, x - A hex number (e.g. a colour).
    f - A float.
    s - A string.
    z - An optional string.
    pX - An additional delimiter where X is another character.
    '' - Encloses a litteral string to locate.
    u - User, takes a name, part of a name or an id and returns the id if they're connected.


    Now has IsNumeric integrated into the code.


    Added additional delimiters in the form of all whitespace and an
    optioanlly specified one in the format string.
    -*----------------------------------------------------------------------------*/


    stock sscanf(string[], format[],
    {
    Float,_
    }
    :...)
    {
    #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];
    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':



    {


    new changestr[16], changepos = 0, strpos = stringPos;
    while(changepos < 16 && string[strpos] && string[strpos] != delim)



    {
    changestr[changepos++] = string[strpos++];



    }
    changestr[changepos] = '\0';
    setarg(paramPos,0,_:floatstr(changestr));



    }
    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:



    {
    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;
    }
    [/hide]

    bei mir werden die ganzen sachen nicht in die datei gespeichert
    muss ich noch was machen oder warum geht das nicht
    zur info ist der gleiche code nur ohne kick und setlevel befehl

    Ich mache gerade ein Reallife Server und jetzt ein seltsames Problem.
    Aus dem gamemode grandlarc und den fs Script gl_npcs habe ich mir ein BOT fs gebastelt
    //-------------------------------------------------
    //
    // NPC initialisation for Grand Larceny
    //
    //-------------------------------------------------


    #pragma tabsize 0
    #include <a_samp>
    #include <core>
    #include <float>
    #include "../include/gl_common.inc"


    new total_vehicles_from_files=0;


    //-------------------------------------------------


    public OnFilterScriptInit()
    {
    // SPECIAL
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/trains.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/pilots.txt");

    printf("Total vehicles from files: %d",total_vehicles_from_files);


    ConnectNPC("TrainDriverLV","train_lv");
    ConnectNPC("TrainDriverLS","train_ls");
    ConnectNPC("TrainDriverSF","train_sf");

    ConnectNPC("PilotLV","at400_lv");
    ConnectNPC("PilotSF","at400_sf");
    ConnectNPC("PilotLS","at400_ls");


    // Testing
    //ConnectNPC("TestIdle","onfoot_test");
    //ConnectNPC("TaxiTest","mat_test");

    return 1;
    }


    //-------------------------------------------------
    // IMPORTANT: This restricts NPCs connecting from
    // an IP address outside this server. If you need
    // to connect NPCs externally you will need to modify
    // the code in this callback.


    public OnPlayerConnect(playerid)
    {
    if(IsPlayerNPC(playerid)) {
    new ip_addr_npc[64+1];
    new ip_addr_server[64+1];
    GetServerVarAsString("bind",ip_addr_server,64);
    GetPlayerIp(playerid,ip_addr_npc,64);

    if(!strlen(ip_addr_server)) {
    ip_addr_server = "127.0.0.1";
    }

    if(strcmp(ip_addr_npc,ip_addr_server,true) != 0) {
    // this bot is remote connecting
    printf("NPC: Got a remote NPC connecting from %s and I'm kicking it.",ip_addr_npc);
    Kick(playerid);
    return 0;
    }
    printf("NPC: Connection from %s is allowed.",ip_addr_npc);
    }

    return 1;
    }


    //-------------------------------------------------


    public OnPlayerRequestClass(playerid, classid)
    {
    if(!IsPlayerNPC(playerid)) return 0; // We only deal with NPC players in this script

    new playername[64];
    GetPlayerName(playerid,playername,64);


    if(!strcmp(playername,"TrainDriverLV",true)) {
    SetSpawnInfo(playerid,69,255,1462.0745,2630.8787,10.8203,0.0,-1,-1,-1,-1,-1,-1);
    }
    else if(!strcmp(playername,"TrainDriverSF",true)) {
    SetSpawnInfo(playerid,69,255,-1942.7950,168.4164,27.0006,0.0,-1,-1,-1,-1,-1,-1);
    }
    else if(!strcmp(playername,"TrainDriverLS",true)) {
    SetSpawnInfo(playerid,69,255,1700.7551,-1953.6531,14.8756,0.0,-1,-1,-1,-1,-1,-1);
    }
    else if(!strcmp(playername,"PilotLV",true)) {
    SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
    }
    else if(!strcmp(playername,"PilotSF",true)) {
    SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
    }
    else if(!strcmp(playername,"PilotLS",true)) {
    SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
    }
    else if(!strcmp(playername,"TestIdle",true)) {
    SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
    }
    else if(!strcmp(playername,"TaxiTest",true)) {
    SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
    }


    return 0;
    }


    //-------------------------------------------------


    public OnPlayerSpawn(playerid)
    {
    if(!IsPlayerNPC(playerid)) return 1; // We only deal with NPC players in this script


    new playername[64];
    GetPlayerName(playerid,playername,64);


    if(!strcmp(playername,"TrainDriverLV",true)) {
    PutPlayerInVehicle(playerid,1,0);
    SetPlayerColor(playerid,0xFFFFFFFF);
    }
    else if(!strcmp(playername,"TrainDriverSF",true)) {
    PutPlayerInVehicle(playerid,5,0);
    SetPlayerColor(playerid,0xFFFFFFFF);
    }
    else if(!strcmp(playername,"TrainDriverLS",true)) {
    PutPlayerInVehicle(playerid,9,0);
    SetPlayerColor(playerid,0xFFFFFFFF);
    }
    else if(!strcmp(playername,"PilotLV",true)) {
    PutPlayerInVehicle(playerid,13,0);
    SetPlayerColor(playerid,0xFFFFFFFF);
    }
    else if(!strcmp(playername,"PilotSF",true)) {
    PutPlayerInVehicle(playerid,14,0);
    SetPlayerColor(playerid,0xFFFFFFFF);
    }
    else if(!strcmp(playername,"PilotLS",true)) {
    PutPlayerInVehicle(playerid,15,0);
    SetPlayerColor(playerid,0xFFFFFFFF);
    }
    else if(!strcmp(playername,"TestIdle",true)) {
    //PutPlayerInVehicle(playerid,43,0);
    SetPlayerColor(playerid,0xFFFFFFFF);
    }
    else if(!strcmp(playername,"TaxiTest",true)) {
    PutPlayerInVehicle(playerid,968,0);
    SetPlayerColor(playerid,0xFFFFFFFF);
    }


    return 1;
    }


    //-------------------------------------------------
    // EOF


    Server gestartet und alles hat funktioniert
    Dann hab ich die andern Fahrzeuge aus grandlarc in meine Welt platzieren


    #include <a_samp>
    #include <core>
    #include <float>
    #include "../include/gl_common.inc"


    new total_vehicles_from_files=0;


    public OnFilterScriptInit()
    {
    // LAS VENTURAS
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_airport.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_gen.txt");

    // SAN FIERRO
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_airport.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_gen.txt");

    // LOS SANTOS
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_airport.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_inner.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_outer.txt");

    // OTHER AREAS
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/whetstone.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/bone.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/flint.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/tierra.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/red_county.txt");


    printf("Total vehicles from files: %d",total_vehicles_from_files);
    }
    Hab server gestarten und überrall standen Autos wie es sich gehört^^
    bin zum Bahnhof gefahren kam aber kein Zug sondern ein LSPD Auto??
    und statt Flugzeuge fliegen die Piloten jetzt Feuerwehr Autos??
    alle Züge und Flugzeuge stehen am richtigen platzt nur die npc verwenden andere Fahrzeuge


    hat wer ne Idee wie ich das Problem löse


    P.S. ich bekomme Stunt Bonus wen ich im Flugzeug Feuerwehrauto mit fliege^^