Beiträge von Mr.Undercover

    Hallo,
    Ich suche ein Selfmade was auf MySQL bassiert.
    Über mich:
    Ich bin 15Jahre alt und möchte momentan MySQL lernen
    Weshalb ich erne ein Script für Anfänger hätte
    Ich scripte neben bei und habe kein Projekt
    Zu meinen Hobby´s hören
    Jugend Feuerwehr, SAMP und mit Freunden raus


    Es soll folgendes haben


    Login u. Registrier System
    2-3Fraktionen (Gang/PD/Medic)
    TotenSystem
    KnastSystem (Verhaften pro WTD 1min)
    AdminSystem
    BankSystem


    Halt für anfänger
    Es solle 10€ kosten da es nicht viel beinhalten muss
    Mit freundlichen Grüßen


    [Folgendes muss im Thema enthalten sein und darf nicht entfernt werden:]
    ______
    Unverbindlicher Hinweis: Die Sicherheit einer Transaktion kann am besten durch die Einschaltung eines Mittelsmannes gewährleistet werden. Weitere Informationen dazu gibt es hier.

    Hey,
    Wenn man tankt bassiert momentan Nichts


    if(strcmp(cmd, "/tanken", true) == 0 || strcmp(cmd, "/tankcar", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    for(new b = 0; b < sizeof(TankeInfo); b++)
    {

    if(IsPlayerInRangeOfPoint(playerid,5.0, TankeInfo[b][tEntranceX], TankeInfo[b][tEntranceY], TankeInfo[b][tEntranceZ]))
    {
    if(IsANoTachoVehicle(GetPlayerVehicleID(playerid)))
    {
    SendClientMessage(playerid,COLOR_GRAD1,"Du kannst dein Fahrrad nicht Auftanken!");
    }
    else
    {
    SetTimer("Fillup",RefuelWait,0);
    Refueling[playerid] = 1;
    TogglePlayerControllable(playerid, 0);
    SendClientMessage(playerid,COLOR_WHITE,"Dein Fahrzeug wird betankt, bitte warten...");
    format(string, sizeof(string), "UserCMD: %s Tankt an einer Tankstelle auf (/fill).", PlayerName(playerid));
    ABroadCast(COLOR_LIGHTRED,string, 5);
    }
    }
    else
    {
    //SendClientMessage(playerid,COLOR_GREY,"Du bist an keiner Tankstelle!");
    //return 1;
    }
    }
    }
    return 1;
    }


    Der Enum
    enum tInfo
    {
    tOwned,
    tOwner[64],
    tMessage[128],
    tExtortion[MAX_PLAYER_NAME],
    Float:tEntranceX,
    Float:tEntranceY,
    Float:tEntranceZ,
    tLevelNeeded,
    tBuyPrice,
    tEntranceCost,
    tTill,
    tLocked,
    tInterior,
    tProducts,
    tMaxProducts,
    tPriceProd,
    };


    Timer
    public Fillup()
    {
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    new VID;
    new FillUp;
    //new FillUpRandom = random(250)+1;
    new string[256];
    VID = GetPlayerVehicleID(i);
    FillUp = GasMax - Gas[VID];
    for(new b = 0; b < sizeof(TankeInfo); b++)
    {
    if(IsPlayerInRangeOfPoint(i,5.0, TankeInfo[b][tEntranceX], TankeInfo[b][tEntranceY], TankeInfo[b][tEntranceZ]))
    {
    if(Refueling[i] == 1)
    {
    if(GetPlayerMoney(i) >= FillUp+4)
    {
    Gas[VID] += FillUp;
    FillUp = FillUp * TankeInfo[b][tEntranceCost];
    format(string,sizeof(string),"* Du hast dein Fahrzeug für $%d aufgetankt.",FillUp);
    SendClientMessage(i,COLOR_LIGHTBLUE,string);
    TogglePlayerControllable(i, 1);
    TogglePlayerControllable(i, 1);
    GivePlayerMoney(i, - FillUp);
    TankeInfo[b][tTill] += FillUp;
    /// TankeInfo[b][tTill] += FillUpRandom;
    TankeInfo[b][tExtortion] += FillUp;
    // TankeInfo[b][tExtortion] += FillUpRandom;
    Refueling[i] = 0;
    // SBizzInfo[3][sbTill] += FillUp; //inhaber
    // SBizzInfo[3][sbExtortion] += FillUpRandom; //mitinhaber
    }
    else
    {
    TogglePlayerControllable(i, 1);
    new cost = TankeInfo[b][tEntranceCost];
    format(string,sizeof(string),"* Nicht genug Geld zum Auffüllen, du benötigst $%d zum Auffüllen deines Autos.",cost);
    SendClientMessage(i,COLOR_LIGHTBLUE,string);
    }
    }
    }
    }
    }
    }
    return 1;
    }
    Koordinaten der Tankstellen
    public LoadTanke()//(c)SRP-team
    {
    new arrCoords[16][64];
    new strFromFile2[256];
    new File: file = fopen("fuelstations.cfg", io_read);
    if (file)
    {
    new idx;
    while (idx < sizeof(TankeInfo))
    {
    fread(file, strFromFile2);
    split(strFromFile2, arrCoords, '|');
    TankeInfo[idx][tOwned] = strval(arrCoords[0]);
    strmid(TankeInfo[idx][tOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255);
    strmid(TankeInfo[idx][tMessage], arrCoords[2], 0, strlen(arrCoords[2]), 255);
    strmid(TankeInfo[idx][tExtortion], arrCoords[3], 0, strlen(arrCoords[3]), 255);
    TankeInfo[idx][tEntranceX] = floatstr(arrCoords[4]);
    TankeInfo[idx][tEntranceY] = floatstr(arrCoords[5]);
    TankeInfo[idx][tEntranceZ] = floatstr(arrCoords[6]);
    TankeInfo[idx][tLevelNeeded] = strval(arrCoords[7]);
    TankeInfo[idx][tBuyPrice] = strval(arrCoords[8]);
    TankeInfo[idx][tEntranceCost] = strval(arrCoords[9]);
    TankeInfo[idx][tTill] = strval(arrCoords[10]);
    TankeInfo[idx][tLocked] = strval(arrCoords[11]);
    TankeInfo[idx][tInterior] = strval(arrCoords[12]);
    TankeInfo[idx][tProducts] = strval(arrCoords[13]);
    TankeInfo[idx][tMaxProducts] = strval(arrCoords[14]);
    TankeInfo[idx][tPriceProd] = strval(arrCoords[15]);
    idx++;
    }
    fclose(file);
    }
    return 1;
    }


    Die Datei auf die zugegriffen wird


    Wenn ich mich einlogge kommt kein Login oder Registrier Fenster??
    Weiß einer woran das Liegt


    public OnPlayerConnect(playerid)
    {
    new Query[200];
    SendClientMessage(playerid,-1,"Willkommen auf dem Server");
    mysql_format(m_connect,Query,"SELECT * FROM `accounts` WHERE `Name` = '%s'",PlayerName(playerid));
    mysql_function_query(m_connect,Query,true,"OnPlayerCheckAccount","i", playerid);
    if(PlayerInfo[playerid][pBan] == 1)return Kick(playerid);
    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    if(GetPVarInt(playerid,"Login") == 1){
    SavePlayerData(playerid);
    SetPVarInt(playerid, "Login", 0);
    SetPVarInt(playerid, "WPW", 0);
    for(new x; pStats:x < pStats; x++) PlayerInfo[playerid][pStats:x] = 0;
    }
    return 1;
    }


    public OnPlayerSpawn(playerid)
    {
    if(GetPVarInt(playerid,"Login") == 0)return Kick(playerid);
    printf("spawn");
    return 1;
    }


    forward OnPlayerCheckAccount(playerid);
    public OnPlayerCheckAccount(playerid)
    {
    new row, field;
    cache_get_data(row,field);
    if(!row){
    SendClientMessage(playerid,-1,"Dein Account wurde nicht bei uns gefunden. Bitte registriere dich bei uns.");
    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Registrierung","Bitte gebe dein gewünschtes Passwort hier ein","Registrieren","Abbrechen");
    }else{
    new Query[200];
    SendClientMessage(playerid,-1,"Dein Account wurde gefunden. Bitte logge dich ein.");
    mysql_format(m_connect,Query,"SELECT * FROM `accounts` WHERE `Name` = '%s'",PlayerName(playerid));
    mysql_function_query(m_connect,Query,true,"OnPlayerLoadPlayerData","i",playerid);
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","Gebe nun dein Passwort ein","Anmelden","Abbrechen");
    printf("Checkaccounts");
    }
    return 1;
    }


    Mit freundlichen Grüßen

    Hey,
    Wenn ich mich einlogge kommt kein Login O. registrier Fenster
    Weiß einer warum das so ist


    public OnPlayerConnect(playerid)
    {
    strdel(Query,0,STR_LEN);
    for(new x; pStats:x < pStats; x++) PlayerInfo[playerid][pStats:x] = 0;
    GetPlayerName(playerid,PlayerInfo[playerid][pName],20);
    SendClientMessage(playerid,-1,"Willkommen auf dem Server");
    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    if(player_loged_in{playerid}){
    SavePlayerData(playerid);
    player_loged_in{playerid}=false;
    enter_password_try{playerid}=0;
    }
    return 1;
    }


    public OnPlayerSpawn(playerid)
    {
    if(player_loged_in{playerid}==false)return Kick(playerid);
    return 1;
    }
    public OnPlayerRequestClass(playerid, classid)
    {
    printf("Hallo3");
    TogglePlayerSpectating(playerid,1);
    SetTimerEx("LoginCamera", 100, false, "i", playerid);
    printf("Hallo1");
    return 1;
    }


    public OnPlayerCheckAccount(playerid)
    {
    new row, field;
    cache_get_data(row,field);
    if(!row)return ShowPlayerDialog(playerid, DIALOG_REGISTER_ACCEPT, DIALOG_STYLE_MSGBOX,"Registrierung",DIALOG_REGISTER_ACCEPT_TEXT,"Weiter","Abbrechen");
    else{
    cache_get_field_content(0,"Password",PlayerInfo[playerid][pPassword]);
    cache_get_field_content(0,"LastLogin",PlayerInfo[playerid][pLastLogin]);
    cache_get_field_content(0,"Ban",PlayerInfo[playerid][pBan]);
    if(PlayerInfo[playerid][pBan] == 1)return Kick(playerid);
    strdel(Query,0,STR_LEN);
    strdel(ALLSTRING,0,sizeof(ALLSTRING));
    format(ALLSTRING,64,"Passworteingabe | Letzer Login: {FF8C00}%s",PlayerInfo[playerid][pLastLogin]);
    SendClientMessage(playerid,-1,"Dein Account wurde gefunden. Bitte logge dich ein.");
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login",ALLSTRING,"Anmelden","Abbrechen");
    }
    return 1;
    }
    public OnPlayerLoadPlayerData(playerid)
    {
    new data[30];
    cache_get_row(0,0,PlayerInfo[playerid][pName]);
    cache_get_row(0,2,data); PlayerInfo[playerid][pAge] = strval(data);
    cache_get_row(0,3,PlayerInfo[playerid][pCountry]);
    cache_get_row(0,4,data); PlayerInfo[playerid][pLevel] = strval(data);
    cache_get_row(0,5,data); PlayerInfo[playerid][pAdmin] = strval(data);
    cache_get_row(0,6,data); PlayerInfo[playerid][pDonate] = strval(data);
    cache_get_row(0,7,PlayerInfo[playerid][pGender]);
    cache_get_row(0,8,data); PlayerInfo[playerid][pMoney] = strval(data);
    cache_get_row(0,9,data); PlayerInfo[playerid][pBank] = strval(data);
    cache_get_row(0,10,data); PlayerInfo[playerid][pPosX] = floatstr(data);
    cache_get_row(0,11,data); PlayerInfo[playerid][pPosY] = floatstr(data);
    cache_get_row(0,12,data); PlayerInfo[playerid][pPosZ] = floatstr(data);
    cache_get_row(0,13,data); PlayerInfo[playerid][pVW] = strval(data);
    cache_get_row(0,14,data); PlayerInfo[playerid][pInt] = strval(data);
    cache_get_row(0,15,data); PlayerInfo[playerid][pFraction] = strval(data);
    cache_get_row(0,16,data); PlayerInfo[playerid][pCarlic] = strval(data);
    cache_get_row(0,17,data); PlayerInfo[playerid][pBikelic] = strval(data);
    cache_get_row(0,18,data); PlayerInfo[playerid][pPlanelic] = strval(data);
    cache_get_row(0,19,data); PlayerInfo[playerid][pLKWlic] = strval(data);
    cache_get_row(0,20,data); PlayerInfo[playerid][pHelilic] = strval(data);
    cache_get_row(0,21,data); PlayerInfo[playerid][pHealth] = floatstr(data);
    cache_get_row(0,22,data); PlayerInfo[playerid][pArmour] = floatstr(data);
    cache_get_row(0,25,PlayerInfo[playerid][pRegdate]);
    TogglePlayerSpectating(playerid,0);
    SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
    GivePlayerMoney(playerid,PlayerInfo[playerid][pMoney]);
    SetCameraBehindPlayer(playerid);
    SetSpawnInfo(playerid, 0, 0, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], 0.0, 0, 0, 0, 0, 0, 0);
    SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pVW]);
    SetPlayerInterior(playerid,PlayerInfo[playerid][pInt]);
    player_loged_in{playerid}=true;
    strdel(Query,0,STR_LEN);
    mysql_format(m_connect,Query,"UPDATE `accounts` SET `LastLogin` = NOW() WHERE `Name` = '%s'",PlayerName(playerid));
    mysql_function_query(m_connect,Query,false,"","");
    return SpawnPlayer(playerid);
    }
    public OnQueryError( errorid, error[], callback[], query[], connectionHandle ){
    printf("EID: %d | Error: %s | callback: %s | Query: %s", errorid, error, callback, query);
    return 1;
    }
    stock Databaseconnect()
    {
    if(mysql_ping(m_connect) == 1)return print("Verbindung hergestellt");
    else{
    m_connect = mysql_connect("localhost", "root", "samp_db", "");
    if(mysql_ping(m_connect) == 1)return print("Verbindung hergestellt");
    else{
    print("Verbindung fehlgeschlagen");
    SendRconCommand("exit");
    return 1;
    }
    }
    }
    stock SavePlayerData(playerid)
    {
    strdel(Query,0,STR_LEN);
    GetPlayerPos(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
    PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
    PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
    PlayerInfo[playerid][pMoney] = GetPlayerMoney(playerid);
    GetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
    GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
    mysql_format(m_connect,Query,"UPDATE `accounts` SET `Name` = '%s', `Level` = '%d', `Admin` = '%d', `Donate` = '%d', `Money` = '%d', `Bank` = '%d', `X` = '%f', `Y` = '%f', `Z` = '%f', `VW` = '%d', `Interior` = '%d', `Fraction` = '%d', `Carlic` = '%d', `Bikelic` = '%d', `Planelic` = '%d', `LKWlic` = '%d', `Helilic` = '%d', `Health` = '%f', `Armour` = '%f', `Ban` = '%d' WHERE `Name` = '%s' ",PlayerName(playerid),PlayerInfo[playerid][pLevel],PlayerInfo[playerid][pAdmin],PlayerInfo[playerid][pDonate],
    PlayerInfo[playerid][pMoney],PlayerInfo[playerid][pBank],PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ],PlayerInfo[playerid][pVW],PlayerInfo[playerid][pInt],PlayerInfo[playerid][pFraction],PlayerInfo[playerid][pCarlic],PlayerInfo[playerid][pBikelic],PlayerInfo[playerid][pPlanelic],PlayerInfo[playerid][pLKWlic],PlayerInfo[playerid][pHelilic],PlayerInfo[playerid][pHealth],PlayerInfo[playerid][pArmour],PlayerInfo[playerid][pBan],PlayerInfo[playerid][pName]);
    mysql_function_query(m_connect,Query,true,"","");
    printf("%d",strlen(Query));
    return 1;
    }
    stock CreateTables()
    {
    mysql_format(m_connect,Query,"CREATE TABLE IF NOT EXISTS `accounts`(`Name` varchar(20) NOT NULL,`Password` varchar(129) NOT NULL,`Age` int(3) NOT NULL,`Country` varchar(20) NOT NULL,`Level` int(10) NOT NULL,`Admin` int(10) NOT NULL,`Donate` int(2) NOT NULL,`Gender` varchar(10) NOT NULL,`Money` int(22) NOT NULL,`Bank` int(22) NOT NULL,`X` float NOT NULL,`Y` float NOT NULL,`Z` float NOT NULL,");
    mysql_format(m_connect,Query,"%s`VW` int(6) NOT NULL,`Interior` int(3) NOT NULL,`Rank` int(2) NOT NULL,`Fraction` int(2) NOT NULL,`Carlic` int(1) NOT NULL,`Bikelic` int(1) NOT NULL,`Planelic` int(1) NOT NULL,`LKWlic` int(1) NOT NULL,`Helilic` int(1) NOT NULL,`Health` float NOT NULL,`Armour` float NOT NULL,`Ban` int(1) NOT NULL,`RegDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',`LastLogin` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00')",Query);
    mysql_function_query(m_connect,Query,false,"","");
    return 1;
    }
    MFG

    Ja,
    Ist es


    SA-MP Dedicated Server
    ----------------------
    v0.3x, (C)2005-2013 SA-MP Team


    [20:38:52] filterscripts = "" (string)
    [20:38:52]
    [20:38:52] Server Plugins
    [20:38:52] --------------
    [20:38:52] Loading plugin: mysql
    [20:38:52]


    > MySQL plugin R7 successfully loaded.


    [20:38:52] Loaded.
    [20:38:52] Loaded 1 plugins.


    [20:38:52]
    [20:38:52] Filterscripts
    [20:38:52] ---------------
    [20:38:52] Loaded 0 filterscripts.


    [20:38:52] Script[gamemodes/MYSQLR7.amx]: Run time error 19: "File or function is not found"
    [20:38:52] Number of vehicle models: 0

    Hey,
    Wie mache ich das in eine daten Bank für MySQL
    enum pStats
    {
    pName[16],
    pPassword[129],
    pAge,
    pCountry[20],
    pLevel,
    pAdmin,
    pDonate,
    pGender[10],
    pMoney,
    pBank,
    Float:pPosX,
    Float:pPosY,
    Float:pPosZ,
    pVW,
    pInt,
    pRank,
    pFraction,
    pCarlic,
    pBikelic,
    pPlanelic,
    pLKWlic,
    pHelilic,
    Float:pHealth,
    Float:pArmour,
    pBan,
    }


    Danke im Voraus