Supportsystem - Fehler

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
  • HeyHoo,


    Ich baue mir grade ein Supportsystem zusammen.
    Habe bei OnPlayerText nun diese Zeilenfolge eingescriptet:

    Spoiler anzeigen

    public OnPlayerText(playerid, text[])
    {
    new string[128];
    if(realchat)
    {
    if(GetPVarInt(playerid,"Mute") == 0)
    {
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "%s sagt: %s", sendername, text);
    ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    return 0;
    }
    else if(GetPVarInt(playerid,"Mute") != 0)
    {
    SendClientMessage(playerid,Rot,"Du wurdest Gemutet!");
    return 0;
    }
    else if(InSupport[playerid] == 1)
    {
    new text1[128];
    new adminlevel[56];
    if(GetPVarInt(playerid,"Adminlevel")==1)format(adminlevel,sizeof(adminlevel),"Supporter");
    else if(GetPVarInt(playerid,"Adminlevel")==3)format(adminlevel,sizeof(adminlevel),"Moderator");
    else if(GetPVarInt(playerid,"Adminlevel")==1335)format(adminlevel,sizeof(adminlevel),"Admin");
    else if(GetPVarInt(playerid,"Adminlevel")==1337)format(adminlevel,sizeof(adminlevel),"Lead-Admin");
    else if(GetPVarInt(playerid,"Adminlevel")==1338)format(adminlevel,sizeof(adminlevel),"Serverinhaber");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(InSupport[playerid] == 1)
    {
    format(string,sizeof(string),"%s(%s) sagt: %s",sendername,adminlevel,text);
    }
    else if(InSupportt[playerid] == 1)
    {
    format(string,sizeof(string),"%s sagt: %s",sendername,text1);
    }

    for(new i=0; i<GetMaxPlayers(); i++)
    {
    if(IsPlayerConnected(i))
    {
    if(InSupport[i] == 1)
    {
    SendClientMessage(i,dr,text);
    SendClientMessage(i,dr,text1);
    SendClientMessage(playerid,dr,text);
    SendClientMessage(playerid,dr,text1);
    return 1;
    }
    }
    }
    }
    else if(InSupportt[playerid] == 1)
    {
    new text1[128];
    new adminlevel[56];
    if(GetPVarInt(playerid,"Adminlevel")==1)format(adminlevel,sizeof(adminlevel),"Supporter");
    else if(GetPVarInt(playerid,"Adminlevel")==3)format(adminlevel,sizeof(adminlevel),"Moderator");
    else if(GetPVarInt(playerid,"Adminlevel")==1335)format(adminlevel,sizeof(adminlevel),"Admin");
    else if(GetPVarInt(playerid,"Adminlevel")==1337)format(adminlevel,sizeof(adminlevel),"Lead-Admin");
    else if(GetPVarInt(playerid,"Adminlevel")==1338)format(adminlevel,sizeof(adminlevel),"Serverinhaber");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(InSupport[playerid] == 1)
    {
    format(string,sizeof(string),"%s(%s) sagt: %s",sendername,adminlevel,text);
    }
    else if(InSupportt[playerid] == 1)
    {
    format(string,sizeof(string),"%s sagt: %s",sendername,text1);
    }

    Spoiler anzeigen
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    if(IsPlayerConnected(i))
    {
    if(InSupport[i] == 1)
    {
    SendClientMessage(i,dr,text);
    SendClientMessage(i,dr,text1);
    SendClientMessage(playerid,dr,text);
    SendClientMessage(playerid,dr,text1);
    return 1;
    }
    }
    }
    }
    }
    return 1;
    }


    Errors, gibt es keine
    doch InGame, wenn Ich den Support meines Freundes annehme, können wir den dr (dunkelrot) Text nicht sehen :(


    Bitte um Hilfe!


    lg
    DJ Deagle

  • Du hast ein paar Sachen ganz schön verdreht
    und musst auch nicht in beiden Funktionen alles
    für Supporter und Fragesteller doppelt abfragen.


    Eine Funktion für Fragesteller, die andere für Supporter.


    else if(InSupport[playerid])
    {
    new adminlevel[56];
    if(GetPVarInt(playerid,"Adminlevel")==1)format(adminlevel,sizeof(adminlevel),"Supporter");
    else if(GetPVarInt(playerid,"Adminlevel")==3)format(adminlevel,sizeof(adminlevel),"Moderator");
    else if(GetPVarInt(playerid,"Adminlevel")==1335)format(adminlevel,sizeof(adminlevel),"Admin");
    else if(GetPVarInt(playerid,"Adminlevel")==1337)format(adminlevel,sizeof(adminlevel),"Lead-Admin");
    else if(GetPVarInt(playerid,"Adminlevel")==1338)format(adminlevel,sizeof(adminlevel),"Serverinhaber");

    GetPlayerName(playerid, sendername, sizeof(sendername));


    new string[128];
    format(string, sizeof(string), "%s(%s) sagt: %s", sendername, adminlevel, text);
    SendClientMessage(playerid, HIER_MAL_EINE_ANDERE_FARBE, string);


    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(InSupportt[i])
    {
    SendClientMessage(i, HIER_MAL_EINE_ANDERE_FARBE, string);
    return 1;
    }
    }
    }
    }


    else if(InSupportt[playerid])
    {
    GetPlayerName(playerid, sendername, sizeof(sendername));


    new string[128];
    format(string, sizeof(string), "%s sagt: %s", sendername, text);
    SendClientMessage(playerid, HIER_MAL_EINE_ANDERE_FARBE, string);


    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(InSupport[i])
    {
    SendClientMessage(i, HIER_MAL_EINE_ANDERE_FARBE, string);
    return 1;
    }
    }
    }
    }

  • Dein System sendet mir das:



    C:\Users\_Zinne\Desktop\SAMP Server\gamemodes\GURv0.0.2.pwn(726) : warning 219: local variable "string" shadows a variable at a preceding level
    C:\Users\_Zinne\Desktop\SAMP Server\gamemodes\GURv0.0.2.pwn(746) : warning 219: local variable "string" shadows a variable at a preceding level
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    2 Warnings.


    /e
    Waren nur Warnings!

  • Ja, Du hast string bereits irgendwo anderes deklariert.


    Also mach's so:


    else if(InSupport[playerid] == true)
    {
    new adminlevel[56];
    if(GetPVarInt(playerid,"Adminlevel")==1)format(adminlevel,sizeof(adminlevel),"Supporter");
    else if(GetPVarInt(playerid,"Adminlevel")==3)format(adminlevel,sizeof(adminlevel),"Moderator");
    else if(GetPVarInt(playerid,"Adminlevel")==1335)format(adminlevel,sizeof(adminlevel),"Admin");
    else if(GetPVarInt(playerid,"Adminlevel")==1337)format(adminlevel,sizeof(adminlevel),"Lead-Admin");
    else if(GetPVarInt(playerid,"Adminlevel")==1338)format(adminlevel,sizeof(adminlevel),"Serverinhaber");


    GetPlayerName(playerid, sendername, sizeof(sendername));


    format(string, sizeof(string), "%s(%s) sagt: %s", sendername, adminlevel, text);
    SendClientMessage(playerid, HIER_MAL_EINE_ANDERE_FARBE, string);


    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(InSupportt[i] == true)
    {
    SendClientMessage(i, HIER_MAL_EINE_ANDERE_FARBE, string);
    return 1;
    }
    }
    }
    }


    else if(InSupportt[playerid] == true)
    {
    GetPlayerName(playerid, sendername, sizeof(sendername));


    format(string, sizeof(string), "%s sagt: %s", sendername, text);
    SendClientMessage(playerid, HIER_MAL_EINE_ANDERE_FARBE, string);


    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(InSupport[i] == true)
    {
    SendClientMessage(i, HIER_MAL_EINE_ANDERE_FARBE, string);
    return 1;
    }
    }
    }
    }