Beiträge von Fabi.StaR

    Nein habe es mal anders versucht und es geht :



    case SQL_LOAD_HOUSE:
    {
    new idx = 1;
    if(num_rows == 0)return 1;
    while(idx < num_rows)
    {
    new h = GetFreeHouse(),tmp[MAX_PLAYER_NAME];
    HouseInfo[h][h_SQLid] = cache_get_field_content_int(idx, "SQLid", mycon);
    cache_get_field_content(idx, "Owner", tmp, mycon);
    strmid(HouseInfo[h][h_Owner],tmp,0,strlen(tmp),MAX_PLAYER_NAME);
    cache_get_field_content(idx, "Discription", tmp, mycon);
    strmid(HouseInfo[h][h_Discription],tmp,0,strlen(tmp),MAX_PLAYER_NAME);
    printf("HausID: %i | Owner: %s",h, HouseInfo[h][h_Owner]);
    HouseInfo[h][h_Owned] = cache_get_field_content_int(idx, "Owned", mycon);
    HouseInfo[h][h_Enter][0] = cache_get_field_content_float(idx, "EnterX", mycon);
    HouseInfo[h][h_Enter][1] = cache_get_field_content_float(idx, "EnterY", mycon);
    HouseInfo[h][h_Enter][2] = cache_get_field_content_float(idx, "EnterZ", mycon);
    HouseInfo[h][h_Exit][0] = cache_get_field_content_float(idx, "ExitX", mycon);
    HouseInfo[h][h_Exit][1] = cache_get_field_content_float(idx, "ExitY", mycon);
    HouseInfo[h][h_Exit][2] = cache_get_field_content_float(idx, "ExitZ", mycon);
    HouseInfo[h][h_Int] = cache_get_field_content_int(idx, "Int", mycon);
    HouseInfo[h][h_Price] = cache_get_field_content_int(idx, "Price", mycon);
    HouseInfo[h][h_NeedLevel] = cache_get_field_content_int(idx, "Level", mycon);
    UpdateHouseInfo(h);
    idx++;
    }
    printf("Es wurden %i Häuser geladen.",idx);
    return 1;
    }

    Danke,


    Nun habe ich probleme beim laden:



    public OnQueryFinish1(query[], resultid, connectionHandle)
    {
    new num_rows,num_fields;
    cache_get_data(num_rows,num_fields,connectionHandle);
    switch(resultid)
    {
    case SQL_LOAD_HOUSE:
    {
    new idx = 0;
    if(num_rows == 0)return 1;
    while(idx < num_rows)
    {
    new h = GetFreeHouse(),tmp[MAX_PLAYER_NAME];
    HouseInfo[h][h_SQLid] = cache_get_field_content_int(idx, "SQLid", mycon);

    cache_get_field_content(idx, "Owner", HouseInfo[h][h_Owner], mycon);//wird nicht geladen
    cache_get_field_content(idx, "Discription", HouseInfo[h][h_Discription], mycon);//wird nicht geladen

    HouseInfo[h][h_Owned] = cache_get_field_content_int(idx, "Owned", mycon);
    HouseInfo[h][h_Enter][0] = cache_get_field_content_float(idx, "EnterX", mycon);
    HouseInfo[h][h_Enter][1] = cache_get_field_content_float(idx, "EnterY", mycon);
    HouseInfo[h][h_Enter][2] = cache_get_field_content_float(idx, "EnterZ", mycon);
    HouseInfo[h][h_Exit][0] = cache_get_field_content_float(idx, "ExitX", mycon);
    HouseInfo[h][h_Exit][1] = cache_get_field_content_float(idx, "ExitY", mycon);
    HouseInfo[h][h_Exit][2] = cache_get_field_content_float(idx, "ExitZ", mycon);
    HouseInfo[h][h_Int] = cache_get_field_content_int(idx, "Int", mycon);
    HouseInfo[h][h_Price] = cache_get_field_content_int(idx, "Price", mycon);
    HouseInfo[h][h_NeedLevel] = cache_get_field_content_int(idx, "Level", mycon);
    UpdateHouseInfo(h);
    idx++;
    }
    printf("Es wurden %i Häuser geladen.",idx);
    return 1;
    }
    }
    return 1;
    }

    Guten Morgen,


    Ich finde den Fehler einfach nicht.


    Wen ich bei einem Haus bin und /edit level 1 eingebe passiert nicht ausser das mir /edit [aktion] [ammount] gesendet wird -.-


    Ich hoffe mir kann einer von euch helfen ;)



    Hier der Befehl:


    if(strcmp(cmd, "/edit") == 0)
    {
    if(pInfo[playerid][pAdminLevel] < 6)return SendClientMessage(playerid,COLOR_GRAD2, "SERVER: Du hast keine Berechtigung für diesen Befehl.");
    new x_job[256];
    x_job = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid,COLOR_GRAD1,"Benutze: /edit [aktion] [ammount]");
    SendClientMessage(playerid,COLOR_GRAD2,"Aktionen: Level, Preis");
    return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /edit aktion] [ammount]");
    SendClientMessage(playerid,COLOR_GRAD2,"Aktionen: Level, Preis");
    return 1;
    }
    new proplev = strval(tmp);
    for(new i = 0; i < sizeof(HouseInfo); i++)
    {
    if(!HouseInfo[i][h_SQLid])continue;
    if(IsPlayerInRangeOfPoint(playerid,5,HouseInfo[i][h_Exit][0],HouseInfo[i][h_Exit][1],HouseInfo[i][h_Exit][2]))
    {
    if(strcmp(x_job,"level",true) == 0)
    {
    HouseInfo[i][h_NeedLevel] = proplev;
    UpdateHouseInfo(i);
    SaveHouse(i);
    return 1;
    }
    if(strcmp(x_job,"preis",true) == 0)
    {
    HouseInfo[i][h_Price] = proplev;
    UpdateHouseInfo(i);
    SaveHouse(i);
    return 1;
    }
    }
    else return SendClientMessage(playerid, COLOR_GRAD2, "In deine nähe ist kein Haus.");
    }
    return 1;
    }

    Mach doch einen stock und frag dort ab ob jemand in der Fraktion ist für den chat ich gebe dir mal ein Beispiel:



    stock isPlayerInStaatsFraktion(playerid)
    {
    new leader = PlayerInfo[playerid][pLeader], member = PlayerInfo[playerid][pMember];


    if(leader == 1 || member == 1)return 1;
    return 0;
    }


    stock SendStaatsMessage(text[])
    {
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
    if(!isPlayerInStaatsFraktion(i))continue;
    SendClientMessage(i,0xFFFFFFFF,text);
    }
    return 1;
    }

    Guten Abend,


    Warum wird die Frabe der Textdraws nicht geändernt:



    Hier das public:


    Spoiler anzeigen

    public Speedometer(playerid)
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && IsPlayerInAnyVehicle(playerid))
    {
    new vehicleid = GetPlayerVehicleID(playerid),kmhstr[20],hpstr[20],gasstr[20];
    new string[128],Float:vHealth,kmh = GetPlayerSpeed(playerid);

    if(kmh >= 80)
    {
    format(kmhstr,sizeof kmhstr, "~r~%i",kmh);
    }
    else
    {
    format(kmhstr,sizeof kmhstr, "~g~%i",kmh);
    }
    if(VehicleGas[vehicleid] <= 10)
    {
    format(gasstr,sizeof gasstr, "~r~%i",VehicleGas[vehicleid]);
    }
    else
    {
    format(gasstr,sizeof gasstr, "~g~%i",VehicleGas[vehicleid]);
    }
    if(vHealth <= 300)
    {
    format(hpstr,sizeof hpstr, "~r~%.1f",vHealth);
    }
    else
    {
    format(hpstr,sizeof hpstr, "~g~%.1f",vHealth);
    }


    GetVehicleHealth(vehicleid,vHealth);
    format(string, 128, "%s~n~%s~n~0~n~%s~n~",kmhstr,gasstr,hpstr);
    TextDrawSetString(Tacho[playerid][1],string);
    TextDrawShowForPlayer(playerid, Tacho[playerid][1]);
    }
    return 1;
    }

    Guten Abend/Morgen,


    Beim laden werden alle Fraktionen bis auf die Letze geladen woran könnte dies liegen?


    Hier der Laden teil:


    Spoiler anzeigen

    case _SQL_FSTUFF_LOAD:
    {
    cache_get_data(num_rows,num_fields);
    new fs = 0,result[50];
    if(num_rows)
    {
    while(num_rows>=fs)
    {
    cache_get_field_content(fs,"Kasse",result);
    FrakInfo[fs][f_Kasse] = strval(result);
    strdel(result,0,sizeof(result));
    printf("** Fraktion: %d Kasse: $%d",fs,FrakInfo[fs][f_Kasse]);
    cache_get_field_content(fs,"Rang0",FrakInfo[fs][f_Rang0]);
    // printf("** Fraktion: %d Rang0 Name: %s",fs+1,FrakInfo[fs][f_Rang0]);
    cache_get_field_content(fs,"Rang1",FrakInfo[fs][f_Rang1]);
    // printf("** Fraktion: %d Rang1 Name: %s",fs+1,FrakInfo[fs][f_Rang1]);
    cache_get_field_content(fs,"Rang2",FrakInfo[fs][f_Rang2]);
    // printf("** Fraktion: %d Rang2 Name: %s",fs+1,FrakInfo[fs][f_Rang2]);
    cache_get_field_content(fs,"Rang3",FrakInfo[fs][f_Rang3]);
    // printf("** Fraktion: %d Rang3 Name: %s",fs+1,FrakInfo[fs][f_Rang3]);
    cache_get_field_content(fs,"Rang4",FrakInfo[fs][f_Rang4]);
    // printf("** Fraktion: %d Rang4 Name: %s",fs+1,FrakInfo[fs][f_Rang4]);
    cache_get_field_content(fs,"Rang5",FrakInfo[fs][f_Rang5]);
    // printf("** Fraktion: %d Rang5 Name: %s",fs+1,FrakInfo[fs][f_Rang5]);
    cache_get_field_content(fs,"Rang6",FrakInfo[fs][f_Rang6]);
    // printf("** Fraktion: %d Rang6 Name: %s",fs+1,FrakInfo[fs][f_Rang6]);
    fs++;
    }
    return 1;
    }
    else return 1;
    }

    Ehm das war nur die SendClientMessage 0o


    Spoiler anzeigen
    if(strcmp(cmd, "/sirene", true) == 0)
    {
    if(PlayerInfo[playerid][pFraktion] != 1)return 1;
    new carid = IsAFraktionsVeh(playerid);
    if(carid == -1)return SendClientMessage(playerid,COLOR_GRAD1,"Du sitzt in keinem Fraktionsfahrzeug.");
    if(GetPlayerVehicleSeat(playerid) != 0)return SendClientMessage(playerid,COLOR_GRAD1,"Nicht der Fahrer des Fahrzeugs.");
    if(FrakCars[carid][f_ModelID] == 560)
    {
    if(FrakCars[carid][FraktionsID] != 1)return SendClientMessage(playerid,COLOR_GRAD1, "Du sitzt in keinem Polizei Fahrzeug.");
    if(FrakCars[carid][f_LightON] == false)
    {
    GetVehicleParamsEx(FrakCars[carid][f_CarID],engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(FrakCars[carid][f_CarID],engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
    DestroyObject(FrakCars[carid][f_Light]);
    FrakCars[carid][f_Light] = CreateObject(19419,0.0,0.0,0.0,0.0,0.0,0.0);
    AttachObjectToVehicle(FrakCars[carid][f_Light], FrakCars[carid][f_CarID], 0.000000, -0.045000, 0.824999, 0.000000, 0.000000, 0.000000);
    SendClientMessage(playerid,COLOR_GREEN,"Undercoverlicht eingeschaltet");
    FrakCars[carid][f_LightON] = true;
    GetVehicleDamageStatus(FrakCars[carid][f_CarID],panels,doors,lights,tires);
    UpdateVehicleDamageStatus(FrakCars[carid][f_CarID],panels,doors,4,tires);
    SetTimerEx("blink",200,0,"i",FrakCars[carid][f_CarID]);
    FrakCars[carid][f_BlikLight] = 0;
    return 1;
    }
    else
    {
    GetVehicleParamsEx(FrakCars[carid][f_CarID],engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(FrakCars[carid][f_CarID],engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
    DestroyObject(FrakCars[carid][f_Light]);
    FrakCars[carid][f_Light] = CreateObject(19420,0.0,0.0,0.0,0.0,0.0,0.0);
    AttachObjectToVehicle(FrakCars[carid][f_Light], FrakCars[carid][f_CarID], 0.000000, -0.045000, 0.824999, 0.000000, 0.000000, 0.000000);
    SendClientMessage(playerid,COLOR_GREEN,"Undercoverlicht ausgeschaltet");
    FrakCars[carid][f_LightON] = false;
    GetVehicleDamageStatus(GetPlayerVehicleID(playerid),panels,doors,lights,tires);
    UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid),panels,doors,5,tires);
    FrakCars[carid][f_BlikLight] = 2255454;
    if(VehicleLights[FrakCars[carid][f_CarID]] == true)
    {
    GetVehicleParamsEx(FrakCars[carid][f_CarID],engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(FrakCars[carid][f_CarID],engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
    }
    return 1;
    }
    }
    }

    Spoiler anzeigen
    if(strcmp(cmd, "/sirene", true) == 0)
    {
    if(PlayerInfo[playerid][pFraktion] != 1)return 1;
    new carid = IsAFraktionsVeh(playerid);
    if(carid == -1)return SendClientMessage(playerid,COLOR_GRAD1,"Du sitzt in keinem Fraktionsfahrzeug.");
    if(GetPlayerVehicleSeat(playerid) != 0)return SendClientMessage(playerid,COLOR_GRAD1,"Nicht der Fahrer des Fahrzeugs.");
    if(FrakCars[carid][f_ModelID] == 560)
    {
    if(FrakCars[carid][FraktionsID] != 1)return SendClientMessage(playerid,COLOR_GRAD1, "Du sitzt in keinem Polizei Fahrzeug.");
    if(FrakCars[carid][f_LightON] == false)
    {
    GetVehicleParamsEx(FrakCars[carid][f_CarID],engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(FrakCars[carid][f_CarID],engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid,COLOR_GREEN,"Undercoverlicht eingeschaltet");
    FrakCars[carid][f_LightON] = true;
    GetVehicleDamageStatus(FrakCars[carid][f_CarID],panels,doors,lights,tires);
    UpdateVehicleDamageStatus(FrakCars[carid][f_CarID],panels,doors,4,tires);
    SetTimerEx("blink",200,0,"i",FrakCars[carid][f_CarID]);
    FrakCars[carid][f_BlikLight] = 0;
    return 1;
    }
    else
    {
    GetVehicleParamsEx(FrakCars[carid][f_CarID],engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(FrakCars[carid][f_CarID],engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
    DestroyObject(FrakCars[carid][f_Light]);
    FrakCars[carid][f_Light] = CreateObject(19420,0.0,0.0,0.0,0.0,0.0,0.0);
    AttachObjectToVehicle(FrakCars[carid][f_Light], FrakCars[carid][f_CarID], 0.000000, -0.045000, 0.824999, 0.000000, 0.000000, 0.000000);
    SendClientMessage(playerid,COLOR_GREEN,"Undercoverlicht eingeschaltet");
    FrakCars[carid][f_LightON] = false;
    GetVehicleDamageStatus(GetPlayerVehicleID(playerid),panels,doors,lights,tires);
    UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid),panels,doors,5,tires);
    FrakCars[carid][f_BlikLight] = 2255454;
    if(VehicleLights[FrakCars[carid][f_CarID]] == true)
    {
    GetVehicleParamsEx(FrakCars[carid][f_CarID],engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(FrakCars[carid][f_CarID],engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
    }
    return 1;
    }
    }
    }

    Spoiler anzeigen
    forward blink(vehid);
    public blink(vehid)
    {
    if(FrakCars[vehid][f_BlikLight] == 2)return 1;
    if(FrakCars[vehid][f_BlikLight] == 0)
    {
    GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
    UpdateVehicleDamageStatus(vehid,panels,doors,2,tires);
    FrakCars[vehid][f_BlikLight] = 1;
    SetTimerEx("blink",200,0,"i",vehid);
    return 1;
    }
    else if(FrakCars[vehid][f_BlikLight] == 1)
    {
    GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
    UpdateVehicleDamageStatus(vehid,panels,doors,4,tires);
    FrakCars[vehid][f_BlikLight] = 0;
    SetTimerEx("blink",200,0,"i",vehid);
    return 1;
    }
    return 1;
    }

    Guten Abend,


    Ich habe folgendes Problem:


    Wenn ich /sirene ein gebe blinkt daa licht hin un her. Und wenn ich es aus mache und dann /lights eingebe blinkt es weiter.


    Wo könnte der Fehler liegen?


    Sagt mir welchen code ihr brauch und ich zeig ihn euch.

    Guten Tag,


    Die erstellten Fahrzeuge werden nicht gespeichert.


    Hier die stocks:


    Spoiler anzeigen
    stock CreateFraktionCar(FrakID,ModelID,Float:x,Float:y,Float:z,Float:rot,c1,c2)
    {
    for(new carid = 0; carid < sizeof FrakCars; carid++)
    {
    if(FrakCars[carid][f_CarID] != 0)continue;
    FrakCars[carid][FraktionsID] = FrakID;
    FrakCars[carid][f_ModelID] = ModelID;
    FrakCars[carid][fPos][0] = x;
    FrakCars[carid][fPos][1] = y;
    FrakCars[carid][fPos][2] = z;
    FrakCars[carid][fPos][3] = rot;
    FrakCars[carid][f_Color][0] = c1;
    FrakCars[carid][f_Color][1] = c2;
    FrakCars[carid][f_CarID] = CreateVehicle(FrakCars[carid][f_ModelID],FrakCars[carid][fPos][0],FrakCars[carid][fPos][1],FrakCars[carid][fPos][2],FrakCars[carid][fPos][3],FrakCars[carid][f_Color][0],FrakCars[carid][f_Color][1],-1);
    printf("Server-Info: Fraktions Fahrzeug mit der ID %i wurde erstellt.",FrakCars[carid][f_CarID]);
    SaveFraktionCars(carid);
    return 1;
    }
    return 1;
    }

    Spoiler anzeigen
    stock SaveFraktionCars(carid)
    {
    new query[128];
    format(query,sizeof query, "INSERT INTO "#SERVER_TAG"_fraktion_cars (Fraktion,Model,PosX,PosY,PosZ,PosA,Color1,Color2) VALUES ('%i','%i','%f','%f','%f','%f','%i','%i')",
    FrakCars[carid][FraktionsID],FrakCars[carid][f_ModelID],FrakCars[carid][fPos][0],FrakCars[carid][fPos][1],FrakCars[carid][fPos][2],FrakCars[carid][fPos][3],FrakCars[carid][f_Color][0],FrakCars[carid][f_Color][1]);
    mysql_function_query(MySqlConnection,query,false,"","");
    mysql_free_result();
    FrakCars[carid][db_ID] = mysql_insert_id();
    printf("Die Datenbank id vom Fahrzeug lautet: %i",FrakCars[carid][db_ID]);
    return 1;
    }


    Hier der Mysql Log:


    Code
    [17:21:57] Passing query INSERT INTO DcR_fraktion_cars (Fraktion,Model,PosX,PosY,PosZ,PosA,Color1,Color2) VALUES ('1','596','1595.106933','-1679.645874' | [17:21:57] CMySQLHandler::FreeResult() - The result is already empty.[17:21:57] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()[17:21:57] >> mysql_insert_id( Connection handle: 1 )[17:21:57] OnQueryError() - Called.