Beiträge von Weihnachtsmann

    Mach es mal so


    new Float:sprunk[][] ={
    {1193.9169,-917.8405,43.1735},
    {1319.4774,-1163.1006,23.8281},
    {1586.4425,-1287.6812,17.5550},
    {1834.9994,-1192.2375,23.7038},
    {2354.2388,-1471.2247,23.9449}
    };
    CMD:sprunk(playerid,params[])
    {
    new rand = Random(sizeof(sprunk));
    SetPlayerCheckpoint(playerid, sprunk[rand][0], sprunk[rand][1], sprunk[rand][2], 3.0);


    return 1;
    }

    Wie bekomme ich es beim Login/Register Dialog so hin, das wenn man joint das man halt bei GTA beim Anfangbildschirm ist und das Dialog kommt und WENN man das RICHTIGE Passwort eingeben hat, man erst spawnt.
    Bei mir ist es so, ich spawne und dann kommt der Dialog ...



    public OnPlayerRequestClass(playerid, classid)
    {
    SetSpawnInfo( playerid, 0, pInfo[playerid][pSkin], 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 );
    SpawnPlayer(playerid);
    return 1;
    }


    public OnUserCheck(playerid)
    {
    new num_rows,num_fields;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(num_rows==0)
    {
    //Registrierung
    ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registrierung","Gib bitte dein gewünschtes Passwort an:","Okay","Abbrechen");
    }
    else
    {
    //Login
    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Okay","Abbrechen");
    }
    return 1;
    }


    public OnPlayerConnect(playerid)
    {
    //Login/Register
    new name[MAX_PLAYER_NAME],query[128];
    GetPlayerName(playerid,name,sizeof(name));
    format(query,sizeof(query),"SELECT id FROM user WHERE username='%s'",name);
    mysql_function_query(dbhandle,query,true,"OnUserCheck","i",playerid);
    return 1;

    Hallo,
    Ich habe eine Funktion erstellt die eigentlich den Admin Namen des Admins auslesen soll, aber es klappt nicht so richtig ...



    stock Adminlevel(rang)
    {
    new rang[70];
    switch(pInfo[playerid][pAdmin])
    {
    case 1: rang = "Probe Supporter";
    case 2: rang = "Supporter";
    case 1: rang = "Administrator";
    case 1: rang = "Full Administrator";
    case 1: rang = "Head Administrator";
    case 1: rang = "Projektleitung";
    }
    return rang;
    }


    Vergessen mit dem Inputtext! Ja habe ich :S
    Ah net, doch nicht sry xd

    Wie ändert sich nicht die MYSQL ID in der Datenbank wenn ich einen neuen Account erstellen will. Gerade kann ich nur einen Account erstellen, weil der eine Account die ID 0 hat und wenn man halt einen neuen Account erstellen will gehts nichts..



    #include <a_samp>
    #include <a_mysql>


    #define db_host "localhost"
    #define db_username "root"
    #define db_passwort " "
    #define db_dbname "test"


    //DIALOGE
    #define DIALOG_REGI 1
    #define DIALOG_LOGIN 2
    new db;
    main()
    {
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
    }


    public OnGameModeInit()
    {
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

    //MYSQL
    db = mysql_connect(db_host,db_username,db_dbname,db_passwort);
    return 1;
    }


    public OnGameModeExit()
    {
    mysql_close(db);
    return 1;
    }


    public OnPlayerRequestClass(playerid, classid)
    {
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
    }
    forward OnUserCheck(playerid);
    public OnUserCheck(playerid)
    {
    new num_rows,num_fields;
    cache_get_data(num_rows,num_fields,db);
    if(num_rows == 0)
    {
    //Registierung
    ShowPlayerDialog(playerid,DIALOG_REGI,DIALOG_STYLE_INPUT,"Kein Account gefunden","Du hast noch keinen Account","Registrieren","Abbrechen");
    }else {
    //Login
    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Account gefunden!","Bitte logge dich mit deinem Passwort ein!","Anmelden","Abbrechen");
    }
    return 1;
    }
    public OnPlayerConnect(playerid)
    {
    //Login/Register
    new name[MAX_PLAYER_NAME],query[128];
    GetPlayerName(playerid,name,sizeof(name));
    format(query,128,"SELECT id FROM user WHERE username = '%s'",name);
    mysql_function_query(db,query,true,"OnUserCheck","i",playerid);
    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    return 1;
    }


    public OnPlayerSpawn(playerid)
    {
    return 1;
    }


    public OnPlayerDeath(playerid, killerid, reason)
    {
    return 1;
    }


    public OnVehicleSpawn(vehicleid)
    {
    return 1;
    }


    public OnVehicleDeath(vehicleid, killerid)
    {
    return 1;
    }


    public OnPlayerText(playerid, text[])
    {
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    return 1;
    }


    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    return 1;
    }


    public OnPlayerExitVehicle(playerid, vehicleid)
    {
    return 1;
    }


    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    return 1;
    }


    public OnPlayerEnterCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerLeaveCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerEnterRaceCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerLeaveRaceCheckpoint(playerid)
    {
    return 1;
    }


    public OnRconCommand(cmd[])
    {
    return 1;
    }


    public OnPlayerRequestSpawn(playerid)
    {
    return 1;
    }


    public OnObjectMoved(objectid)
    {
    return 1;
    }


    public OnPlayerObjectMoved(playerid, objectid)
    {
    return 1;
    }


    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    return 1;
    }


    public OnVehicleMod(playerid, vehicleid, componentid)
    {
    return 1;
    }


    public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
    {
    return 1;
    }


    public OnVehicleRespray(playerid, vehicleid, color1, color2)
    {
    return 1;
    }


    public OnPlayerSelectedMenuRow(playerid, row)
    {
    return 1;
    }


    public OnPlayerExitedMenu(playerid)
    {
    return 1;
    }


    public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
    {
    return 1;
    }


    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    return 1;
    }


    public OnRconLoginAttempt(ip[], password[], success)
    {
    return 1;
    }


    public OnPlayerUpdate(playerid)
    {
    return 1;
    }


    public OnPlayerStreamIn(playerid, forplayerid)
    {
    return 1;
    }


    public OnPlayerStreamOut(playerid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamIn(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamOut(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    switch(dialogid)
    {
    case DIALOG_REGI:
    {
    if(response)
    {
    new name[MAX_PLAYER_NAME],query[128],password[35];
    GetPlayerName(playerid,name,sizeof(name));
    mysql_escape_string(inputtext,password,db);
    format(query,128,"INSERT INTO user (username,password) VALUES ('%s','%s')",name,inputtext);
    mysql_function_query(db,query,false,"","");
    }else
    {
    Kick(playerid);
    }
    }
    }
    return 1;
    }


    public OnPlayerClickPlayer(playerid, clickedplayerid, source)
    {
    return 1;
    }

    Den Code wo die accounts erstellt werden ...


    sInfo[playerid][eingeloggt] = 1;
    sInfo[playerid][level] = cache_get_field_content_int(0,"level",dbhandle);
    SetPlayerScore(playerid,sInfo[playerid][level]);
    sInfo[playerid][id] = cache_get_field_content_int(0,"id",dbhandle);
    SetPlayerMoney(playerid,cache_get_field_content_int(0,"money",dbhandle));



    if(dialogid==DIALOG_REGISTER)
    {
    if(response)
    {
    new name[MAX_PLAYER_NAME],query[128],passwort[35];
    GetPlayerName(playerid,name,sizeof(name));
    if(strlen(inputtext)>3)
    {
    mysql_escape_string(inputtext,passwort,dbhandle);
    format(query,sizeof(query),"INSERT INTO user (username,password) VALUES ('%s','%s') ",name,passwort);
    mysql_function_query(dbhandle,query,false,"","");
    }
    else
    {

    SendClientMessage(playerid,COLOR_RED,"Dein Passwort muss mindestens 4 Zeichen lang sein.");
    ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registrierung","Gib bitte dein gewünschtes Passwort an:","Okay","Abbrechen");
    }
    }
    else
    {
    Kick(playerid);
    }
    return 1;
    }

    Hallo,
    I.wie wird kein 2ter Account erstellt in der Datenbank, da die ID 0 bleibt und wenn man sich neu registriert halt nicht weiter geht.
    Wie kann ich das beheben?


    mfg

    Wenn man den Befehl am Punkt eingibt, kommt dieses Unknown Command, ich habe den Fehler nicht endeckt.
    Könnt ihr mir helfen?



    if(strcmp("/freegangcar", cmd, true) == 0)
    {
    if(PlayerToPoint(5.0,playerid,911.2007,-1235.1824,17.2109))
    {
    if(PlayerInfo[playerid][pRank] >= 11)
    {
    for(new h = 0; h < sizeof(GangAutoInfo); h++){
    new AusloesePreis,
    CarTyp;
    if(PlayerInfo[playerid][pLeader] == GangAutoInfo[h][cOwner] || PlayerInfo[playerid][pMember] == GangAutoInfo[h][cOwner]){
    for(new hh = 0; hh < sizeof(GangAutoKaufliste); hh++)
    {
    if(GangAutoKaufliste[hh][GAModelid] == GangAutoInfo[h][cTyp])
    {
    CarTyp = hh;
    }
    }
    AusloesePreis = GangAutoKaufliste[CarTyp][GAReparatur];
    if(GangAutoInfo[h][cStatus] == 2)
    {
    if(AusloesePreis <= KassenInfo[GangAutoInfo[h][cOwner]][tKasse])
    {
    GangAutoInfo[h][cPosX] = 867.0596;
    GangAutoInfo[h][cPosY] = -1210.6304;
    GangAutoInfo[h][cPosZ] = 16.6730;
    GangAutoInfo[h][cRot] = 179.7786;
    KassenInfo[13][tKasse] += AusloesePreis;
    new Standschon;
    if(GangAutoInfo[h][cStandTime] > 500)
    {
    Standschon = Time()-GangAutoInfo[h][cStandTime];
    }
    else
    {
    Standschon = 3600;
    }
    new Kosten = Standschon/60*25;
    GangAutoInfo[h][cStatus] = 0;
    CreateNewlyGangAutos(h);
    KassenInfo[GangAutoInfo[h][cOwner]][tKasse] -= AusloesePreis;
    KassenInfo[GangAutoInfo[h][cOwner]][tKasse] -= Kosten;
    SetPlayerCheckpoint(playerid, 867.0596,-1210.6304,16.6730,10.0);
    CP[playerid] = 22;
    GangAutoInfo[h][cStandTime] = 0;
    format(string, sizeof(string), "Du hast einen %s für %s$ freigekauft, das Auto steht nun vor unserem Lager bereit.", VehNames[GangAutoInfo[h][cTyp]-400], GetPoint(AusloesePreis));
    SendClientMessage(playerid, COLOR_RED, string);
    format(string, sizeof(string), "Zuzüglich %s$ der Standkosten.", GetPoint(Kosten));
    SendClientMessage(playerid, COLOR_BEIGE, string);
    break;
    }
    }
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_ERRORTEXT, " Du bist kein Rank 11 oder höher !");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_ERRORTEXT, " Du bist nicht am Ordnungsamtgelände !");
    }
    return 1;
    }

    Mhm, also Black Evolution wurde von so einem Crashboy geddost und i.wie in der gleichen Zeit ist auch Samp4You down gegangen.
    Liegt wahrscheinlich an der DDOS Attacke die gegen unseren Server gerichtet haben.


    Kiddies ey.


    Wieso 2x Mysql_Query? :S, kannst du mir es erklären