Rang system

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Bin gerade beim Rangsystem und hab das so gemacht


    #define arang1 "Rekrut"
    #define arang2 "Kanonier"
    #define arang3 "BT-1 | Gefreiter"
    #define arang4 "BT-2 | Obergefreiter"
    #define arang5 "BT-3 | Hauptgefreiter"
    #define arang6 "BT-4 | Oberhauptgefreiter"
    #define arang7 "ST-1 | Scharfschützenanfänger"
    #define arang8 "ST-2 | Scharfschütze"
    #define arang9 "ST-3 | Hauptschütze"
    #define arang10 "ST-4 | Oberschütze"
    #define arang11 "LW-1 | Feldwebel"
    #define arang12 "LW-2 | Oberfeldwebel"
    #define arang13 "LW-3 | Hauptfeldwebel"
    #define arang14 "LW-4 | OberHauptwebel"
    #define arang15 "Leutnant"
    #define arang16 "Oberleutnant*"
    #define arang17 "BT-Oberst**"
    #define arang18 "LW-Oberst***"
    #define arang19 "Generalleutnant****"
    #define arang20 "General*****"


    dann das es bei den stats angezeigt wird


    if(strcmp(cmdtext,"/stats",true)==0)
    {
    new string[128];
    new fraktname[64];
    new Rang[64];
    switch(GetPVarInt(playerid,"Fraktion"))
    {
    case 0:{fraktname="Keine";}
    case 1:{fraktname=fraktname1;}
    case 2:{fraktname=fraktname2;}
    case 3:{fraktname=fraktname3;}
    }
    switch(GetPVarInt(playerid,"Rang"))
    {
    case0:{Rang="keiner";}
    case1:{Rang=arang1;}
    case2:{Rang=arang2;}
    case3:{Rang=arang3;}
    case4:{Rang=arang4;}
    case5:{Rang=arang5;}
    case6:{Rang=arang6;}
    case7:{Rang=arang7;}
    case8:{Rang=arang8;}
    case9:{Rang=arang9;}
    case10:{Rang=arang10;}
    case11:{Rang=arang11;}
    case12:{Rang=arang12;}
    case13:{Rang=arang13;}
    case14:{Rang=arang14;}
    case15:{Rang=arang15;}
    case16:{Rang=arang16;}
    case17:{Rang=arang17;}
    case18:{Rang=arang18;}
    case19:{Rang=arang19;}
    case20:{Rang=arang20;}

    }
    format(string,sizeof(string),"[Name: %s] [Level: %i] [Adminlevel: %i] [Fraktion: %s] [Rang: %i]",SpielerName(playerid),GetPlayerScore(playerid),GetPVarInt(playerid,"Adminlevel"),fraktname,Rang);
    SendClientMessage(playerid,COLOR_BLAU,string);
    return 1;
    }


    Da hab ich errors bekommen C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(626) : warning 219: local variable "Rang" shadows a variable at a preceding level
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(636) : error 002: only a single statement (or expression) can follow each "case"
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(636) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(636) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(637) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(637) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(638) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(638) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(639) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(639) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(640) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(640) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(641) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(641) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(642) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(642) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(643) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(643) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(644) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(644) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(645) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(645) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(646) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(646) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(647) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(647) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(648) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(648) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(649) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(649) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(650) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(650) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(651) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(651) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(652) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(652) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(653) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(653) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(654) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(654) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(655) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(655) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(656) : error 022: must be lvalue (non-constant)
    C:\Users\Andreas\Desktop\samp\sampserver\gamemodes\test.pwn(656) : warning 215: expression has no effect
    stock IsPlayerRank(playerid,Rank)
    {
    if(GetPVarInt(playerid,"Rang") >= Rang)//Hier würde ich >= machen, damit alle anderen Einheiten, die ein Höheren Rang haben, auch die Nachricht bekommen.
    return 0;
    }


    stock GetRankName(playerid)
    {
    new faction = GetPVarInt(playerid,"Fraktion");
    new rank = GetPVarInt(playerid,"Rang");


    new tmpstr[32];


    switch ( faction )
    {
    case "Rang"
    {
    switch ( rank )
    {
    return rankNameArray[rank-1];
    }
    }
    }
    }