kostenloser Webspace werbefrei: lima-city


Mit welcher Schleife kann ich ....

lima-cityForumProgrammiersprachenPHP, MySQL & .htaccess

  1. Autor dieses Themas

    politica

    politica hat kostenlosen Webspace.

    Mit welcher Schleife kann ich kann ich folgendes machen f?r "Level ermittlung und bei xp xx n?chstes Level".

    Ich hab jetzt ein bisschen rum probiert aber mir ist nix eingefallen wie es gehen k?nnte:

    Der User startet mit lvl1. Wenn er nun 1000xp gesammelt hat soll auomatisch lvl2 stehen. Wenn man nun auf lvl2 5000xp gesammelt hat soll dan lvl3 stehen und so weiter.

    Ich bekommst nicht ganz hin weil wenn ich :

    $var <= $var2
    ....
    $var2 <= var3
    ....
    kann ich nicht benutzen, logischerweise oder gibt es da einen Befehl der sagt sollte xp ?ber 1000 kommen (nicht gr??er oder gleich als...) ??
  2. Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!

    lima-city: Gratis werbefreier Webspace für deine eigene Homepage

  3. Wie w?re es mit ">="?
  4. Autor dieses Themas

    politica

    politica hat kostenlosen Webspace.

    <= mein ich ja (gr??er als)
    Doch wenn ich das al schleife mache wird es nix :-(

    Beitrag ge?ndert am 12.04.2006 21:59 von politica

    Ich br?uchte eine art schleife in einer scleife :slant:

    Geht das?

    Beitrag ge?ndert am 12.04.2006 21:59 von politica
  5. Es ist nicht dasselbe (auch nicht umgedreht) ... aber das tut hier nichts zur Sache.

    K?nntest du mal erkl?ren, warum ein Vergleich nicht m?glich ist? Ich sehe da kein Problem:

    $punkte = irgendwas;
    $level = 1;
    $level1 = 1000;
    $level2 = 5000;

    ...

    if($punkte >= $level2) $level = $level2;elseif($punkte >= $level1) $level = $level1;

    ...
  6. Autor dieses Themas

    politica

    politica hat kostenlosen Webspace.

    ich wollte das so machen:
    if lvl 1:
    if xp <= 1000
    echo lvl2
    update ........lvl = 2, xp = 0

    if lvl 2 :
    if xp <= 400
    echo lvl3
    update.... lvl = 3, xp = 0

    usw.... das geht aber nicht

    Beitrag ge?ndert am 12.04.2006 22:10 von politica
  7. boah...das ist doch Mathe 5. Klasse oder so...
    Das Zeichen "<" bedeutet "kleiner als".
    Das Zeichen ">" bedeutet "gr??er als".
    <= ist "kleiner gleich"
    >= ist "gr??er gleich"

    So wie du das machst kann es gar nicht gehen, da du immer fragst, ob die XP kleiner als die ben?tigten sind und wenn man am Anfang gar keine XP hat, dann hat man trotzdem die Bedingung erf?llt um lvl 99 zu sein... -.-

    Edit: Alopex...Warum machst du eigentlich die ganze Arbeit von ihm und dann auch noch auf halbwegs elegante Weise...?^^ Seit wann benutzt du denn echo()?

    Beitrag ge?ndert am 12.04.2006 22:24 von i-spacke
  8. ich wollte das so machen:
    if lvl 1:
    if xp <= 1000
    echo lvl2
    update ........lvl = 2, xp = 0

    if lvl 2 :
    if xp <= 400
    echo lvl3
    update.... lvl = 3, xp = 0

    usw.... das geht aber nicht


    Hmm, das sieht auch nicht wie PHP aus ...

    Wie w?re es mit einer Funktion?

    function get_level($points){
    if($points < 0) die('Fehler!');
    $blubb = array(
    // punkte => level
    0 => 1,
    1000 => 2,
    5000 => 3,
    ...
    );
    foreach($blubb as $key => $val) {
    if($points >= $key) break;
    }
    return($val);
    }

    ...

    Den aktuellen Level erh?ltst du jetzt, indem du die Funktion mit der Anzahl der aktuellen Punkte aufrufst:

    $act_level = get_level($xp);
    echo($act_level);

    Beitrag ge?ndert am 12.04.2006 22:21 von alopex
  9. Autor dieses Themas

    politica

    politica hat kostenlosen Webspace.

    @spacke ich kenn das < und >, hab mich nur verschrieben!
  10. Stimmt, deswegen hast du auch dreimal hintereinander dich verschrieben. Selbst nachdem Alopex dich darafu hingewiesen hat. Dein Pseudocode h?tte mit den richtigen Zeichen eigentlich auch Funktioniert, aber egal....
  11. Frag adrians...Desweiteren w?rde ich dich bitten mich nicht "spacki" zu nennen, da es sonst dazu kommen k?nnte, dass ich (noch) agressiv(er) werde. Au?erdem schreibe ich schon seit ein paar Stunden an dieser
    Keeping in Mind that the peoples of the United Nations have in the Charter reaffirmed their faith in fundamental human rights, in the dignity and worth of the human person and in the equal rights of men and women and have determined to promote social progress and better standards of life in larger freedom,

    Also keeping in Mind that Member States have pledged themselves to achieve, in coopera-tion with the United Nations, the promotion of universal respect for and observance of hu-man rights and fundamental freedoms,

    Drawing attention to the fact that the third MDG is to eliminate gender disparity in primary and secondary education preferably by 2005, and at all levels by 2015,

    Also drawing attention to the fact that many young women, especially in the Less-Developed Countries (LDC&#8217;s), have not got any access to any kind of basic education, whereas young men have the access to any available kind of education, just because of social or religious discrimination,

    Noting with deep regret that 70% of the 1.3 billion people living in poverty around the world are women,

    Emphasizing that the most politicians are men and that it is very difficult for women to get the chance to help changing the world into a better one, because they do not get the access to policy,

    Also emphasizing that many women have to suffer from violence against them without any help or chance for help and that in many countries abortion is not allowed so they have to bear the child although they got pregnant because of a rape or incest,

    Recognizing the great work of NGO&#8217;s with their stable and successful effort for the abid-ance by the Universal Declaration of Human Rights,

    Noticing that there exist some kinds of religions which restrain the most of the Human Rights concerning women;

    1. Calls upon all governments to:
    a) Develop policies and programmes to promote:
    i) the human rights with reference to the rights of all women,
    ii) gender equality as a footing of every society;
    b) Ensure the full realization of the human rights of all women, including women migrants and women migrant workers, and their protection against violence and exploitation;

    2. Strongly recommends all countries to:
    a) Introduce measures to integrate or reintegrate women living in poverty and socially marginalized women into productive employment and the economic mainstream;
    b) Ensure that internally displaced women have full access to economic opportu-nities and that the qualifications and skills of immigrant and refugee women are recognized;
    c) Create social security systems wherever they do not exist, or review them with a view to placing individual women and men on an equal footing, at every stage of their lives;
    d) Ensure access to free or low-cost legal services, including legal literacy, espe-cially designed to reach women living in poverty;

    3. Also calls upon all governments to:
    a) take measures to eliminate discrimination in education at all levels on the ba-sis of gender, race, language, religion, national origin, age or disability, or any other form of discrimination;
    b) improve the quality of education and equal opportunities for women and men in terms of access in order to ensure that women of all ages can acquire the knowledge, skills and ethical values needed to develop and to participate fully under equal conditions in the process of social, economic and political devel-opment;
    Resolution und mein Kaffee ist ausgegangen.

    Um nochmal etwas zu sagen, was den Post hier nicht ganz so spammig macht...@alopex das was er da geschrieben hat sollte denke ich nur Pseudocode sein. Sowas wie ein PAP o.?....
  12. Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!

    lima-city: Gratis werbefreier Webspace für deine eigene Homepage

Dir gefällt dieses Thema?

Über lima-city

Login zum Webhosting ohne Werbung!