Problem mit Umwandlung von strcmp zu dcmd

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
  • Hi Leute!


    Ich hab heute versucht strcmp in meinem script zu dcmd umzuwandeln, allerdings hab ich da wohl oder übel irgendwas dabei vergessen ;(




    Mein Compiler zeigte daraufhin aber 3 Errors und ein Warning an:


    Code
    C:\Users\Arlt\Desktop\Samp Server Client\gamemodes\Tim_No1.pwn(915) : warning 203: symbol is never used: "params" 
    C:\Users\Arlt\Desktop\Samp Server Client\gamemodes\Tim_No1.pwn(915 -- 934) : error 010: invalid function or declaration 
    C:\Users\Arlt\Desktop\Samp Server Client\gamemodes\Tim_No1.pwn(915 -- 936) : error 010: invalid function or declaration 
    C:\Users\Arlt\Desktop\Samp Server Client\gamemodes\Tim_No1.pwn(915 -- 942) : error 010: invalid function or declaration 
    C:\Users\Arlt\Desktop\Samp Server Client\gamemodes\Tim_No1.pwn(915 -- 942) : fatal error 107: too many error messages on one line 
    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 
    
    
    4 Errors.




    Woran könnte das liegen? Kann mir jemand helfen?


    Hier der falsche Teil:




    public OnPlayerCommandText(playerid, cmdtext[])
    {
    dcmd(duty, 4, cmdtext);
    dcmd(money, 5, cmdtext);
    dcmd(disarm, 6, cmdtext);
    dcmd(freitod, 7, cmdtext);
    dcmd(regen, 5, cmdtext);
    dcmd(hitze, 5, cmdtext);
    dcmd(nebel, 5, cmdtext);
    dcmd(sturm, 5, cmdtext);
    dcmd(sandsturm, 9, cmdtext);
    dcmd(destroycar, 10, cmdtext);
    dcmd(wolken, 6, cmdtext);
    dcmd(normaleswetter, 14, cmdtext);
    dcmd(healme, 6, cmdtext);
    return 0;
    }
    #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
    dcmd_duty(playerid, params[])
    {
    if(gTeam[playerid] == TEAM_COPS)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 212.5936,188.1724,1003.0313))// PD duty
    {
    GivePlayerWeapon(playerid, 41, 1000);
    GivePlayerWeapon(playerid, 24, 500);
    GivePlayerWeapon(playerid, 29, 500);
    GivePlayerWeapon(playerid, 33, 500);
    GivePlayerWeapon(playerid, 3, 1);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, 0x0000FFFF, "Du bist nun im Dienst!");
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist nicht im PD!"); }
    }
    }
    else if(gTeam[playerid] == TEAM_MEDICS)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 234.9727,109.8153,1010.2188))
    {
    GivePlayerWeapon(playerid, 41, 1000);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, 0x0000FFFF, "Du bist nun im Dienst!");
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist nicht im Krankenhaus!");
    }
    }
    else if(gTeam[playerid] == TEAM_FBI)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, -791.6930,493.9527,1376.1875))
    {
    GivePlayerWeapon(playerid, 24, 1000);
    GivePlayerWeapon(playerid, 41, 1000);
    GivePlayerWeapon(playerid, 34, 500);
    GivePlayerWeapon(playerid, 29, 1000);
    GivePlayerWeapon(playerid, 46, 1);
    GivePlayerWeapon(playerid, 27, 1000);
    GivePlayerWeapon(playerid, 3, 1);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, 0x0000FFFF, "Du bist nun im Dienst!");
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist nicht im Federal Bureau of Investigation!");
    }
    }
    else if(gTeam[playerid] == TEAM_ARMY)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 2527.9780,-1290.1348,1031.4219))
    {
    GivePlayerWeapon(playerid, 41, 1000);
    GivePlayerWeapon(playerid, 1, 1);
    GivePlayerWeapon(playerid, 24, 500);
    GivePlayerWeapon(playerid, 29, 500);
    GivePlayerWeapon(playerid, 34, 500);
    GivePlayerWeapon(playerid, 3, 1);
    GivePlayerWeapon(playerid, 31, 500);
    GivePlayerWeapon(playerid, 25, 500);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, 0x0000FFFF, "Du bist nun im Dienst!");
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist nicht am Army - Stützpunkt!");
    }
    }
    else if(gTeam[playerid] == TEAM_REGIERUNG)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 362.4753,209.5455,1008.3828))
    {
    GivePlayerWeapon(playerid, 41, 1000);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, 0x0000FFFF, "Du bist nun im Dienst!");
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist nicht im Rathaus!");
    }
    }





    Danke schonmal im Vorraus!

  • Das #define dcmd stand bereits vorher richtig, ich habs bloß vergessen zu erwähnen, sry :whistling:




    #pragma unused params ist jetzt drin, zeigt auch wegen dem keine fehler an, sondern nur, dass sämtliche dcmds nicht definded sind....


    Jetzt hab ich echt keine ahnung...











    public OnPlayerCommandText(playerid, cmdtext[])
    {
    dcmd(duty, 4, cmdtext);
    dcmd(money, 5, cmdtext);
    dcmd(disarm, 6, cmdtext);
    dcmd(freitod, 7, cmdtext);
    dcmd(regen, 5, cmdtext);
    dcmd(hitze, 5, cmdtext);
    dcmd(nebel, 5, cmdtext);
    dcmd(sturm, 5, cmdtext);
    dcmd(sandsturm, 9, cmdtext);
    dcmd(destroycar, 10, cmdtext);
    dcmd(wolken, 6, cmdtext);
    dcmd(normaleswetter, 14, cmdtext);
    dcmd(healme, 6, cmdtext);
    return 0;
    }
    dcmd_duty(playerid, params[])
    {
    #pragma unused params
    if(gTeam[playerid] == TEAM_COPS)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 212.5936,188.1724,1003.0313))// PD duty
    {
    GivePlayerWeapon(playerid, 41, 1000);
    GivePlayerWeapon(playerid, 24, 500);
    GivePlayerWeapon(playerid, 29, 500);
    GivePlayerWeapon(playerid, 33, 500);
    GivePlayerWeapon(playerid, 3, 1);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, 0x0000FFFF, "Du bist nun im Dienst!");
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist nicht im PD!");
    }
    }
    else if(gTeam[playerid] == TEAM_MEDICS)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 234.9727,109.8153,1010.2188))
    {
    GivePlayerWeapon(playerid, 41, 1000);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, 0x0000FFFF, "Du bist nun im Dienst!");
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist nicht im Krankenhaus!");
    }
    }
    else if(gTeam[playerid] == TEAM_FBI)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, -791.6930,493.9527,1376.1875))
    {
    GivePlayerWeapon(playerid, 24, 1000);
    GivePlayerWeapon(playerid, 41, 1000);
    GivePlayerWeapon(playerid, 34, 500);
    GivePlayerWeapon(playerid, 29, 1000);
    GivePlayerWeapon(playerid, 46, 1);
    GivePlayerWeapon(playerid, 27, 1000);
    GivePlayerWeapon(playerid, 3, 1);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, 0x0000FFFF, "Du bist nun im Dienst!");
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist nicht im Federal Bureau of Investigation!");
    }
    }
    else if(gTeam[playerid] == TEAM_ARMY)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 2527.9780,-1290.1348,1031.4219))
    {
    GivePlayerWeapon(playerid, 41, 1000);
    GivePlayerWeapon(playerid, 1, 1);
    GivePlayerWeapon(playerid, 24, 500);
    GivePlayerWeapon(playerid, 29, 500);
    GivePlayerWeapon(playerid, 34, 500);
    GivePlayerWeapon(playerid, 3, 1);
    GivePlayerWeapon(playerid, 31, 500);
    GivePlayerWeapon(playerid, 25, 500);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, 0x0000FFFF, "Du bist nun im Dienst!");
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist nicht am Army - Stützpunkt!");
    }
    }
    else if(gTeam[playerid] == TEAM_REGIERUNG)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 362.4753,209.5455,1008.3828))
    {
    GivePlayerWeapon(playerid, 41, 1000);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, 0x0000FFFF, "Du bist nun im Dienst!");
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist nicht im Rathaus!");
    }
    }
    dcmd_money(playerid, params[])
    {
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
    GivePlayerMoney(playerid, 50000);
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Dieser Befehl darf nur von Admins in Ausnahmen benutzt werden!");
    }
    return 1;
    }
    dcmd_disarm(playerid, params[])
    {
    new dplayerid, dgrund[128];
    if(IsPlayerAdmin(playerid))
    {
    if(sscanf(params,"uz",dplayerid,dgrund))
    {
    return SendClientMessage(playerid,0xFF0000FF," [Benutzung]: /disarm [id] [grund(optional)] ");
    }
    if(!IsPlayerConnected(dplayerid))
    {
    return SendClientMessage(playerid,0xFF0000FF," Spieler nicht online!");
    }
    if(IsPlayerAdmin(playerid))
    {
    new BoeserPlayer[MAX_PLAYER_NAME], string[128];
    GetPlayerName(dplayerid,BoeserPlayer,sizeof(BoeserPlayer));
    format(string,sizeof(string),"%s (ID %d) wurde von einem Admin entwaffnet,Grund: %s",BoeserPlayer,dplayerid,dgrund[0] ? dgrund : "<Kein Grund angegeben>");
    SendClientMessageToAll(0xFF0000FF,string);
    SetPlayerArmour(dplayerid, 0);
    ResetPlayerWeapons(dplayerid);
    }
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Du bist kein Admin!");
    }
    return 1;
    }
    dcmd_freitod(playerid, params[])
    {
    #pragma unused params
    SetPlayerHealth(playerid, 0);
    return 1;
    }
    dcmd_regen(playerid, params[])
    {
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
    SetWeather(16);
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Nur Admins können das Wetter ändern!");
    }
    return 1;
    }
    dcmd_hitze(playerid, params[])
    {
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
    SetWeather(09);
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Nur Admins können das Wetter ändern!");
    }
    return 1;
    }
    dcmd_nebel(playerid, params[])
    {
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
    SetWeather(11);
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Nur Admins können das Wetter ändern!");
    }
    return 1;
    }
    dcmd_sturm(playerid, params[])
    {
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
    SetWeather(08);
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Nur Admins können das Wetter ändern!");
    }
    return 1;
    }
    dcmd_sandsturm(playerid, params[])
    {
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
    SetWeather(19);
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Nur Admins können das Wetter ändern!");
    }
    return 1;
    }
    dcmd_destroycar(playerid, params[])
    {
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
    new vehicleid = GetPlayerVehicleID(playerid);
    SetVehicleHealth(vehicleid, 200.0);
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Du bist kein Admin!");
    }
    return 1;
    }
    dcmd_wolken(playerid, params[])
    {
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
    SetWeather(30);
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Nur Admins können das Wetter ändern!");
    }
    return 1;
    }
    dcmd_normaleswetter(playerid, params[])
    {
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
    SetWeather(0);
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Nur Admins können das Wetter ändern!");
    }
    return 1;
    }
    dcmd_healme(playerid, params[])
    {
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
    SetPlayerHealth(playerid, 100);
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000FF, "Du brauchst einen Medic um geheilt zu werden!");
    }
    }

  • Definiere mal dcmd ganz oben im Script und dass muss so aussehen:


    Achja: dcmd_deincommand(playerid,params[])


    muss unter


    public OnPlayerCommandText(playerid, cmdtext[]) {return 0;}


    sein

    Verkaufe FREEROAM/DM/STUNT/MISSION vollständige Gamemodes Billig
    -> Melden per PN