Script Problem: argument type mismatch

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,
    Ich bin neu hier, ich scripte jetzt seit 2 Tagen an einen Cops and Robbers game.
    Ich habe jetzt zwar ein adminscript, aber wenn ich waffen aus ner datei nem spieler geben will, kommt "argument type mismatch"


    Mein code:
    new i;
    new str1[20];
    new str2[20];
    new str3[5];
    new str4[5];
    for(i; i<13; i++)
    {
    format(str1, sizeof(str1), "Weapon%d", i);
    format(str2, sizeof(str2), "Ammo%d", i);

    if (strfind(passres, str1) != -1)
    {
    value = GetFileValue(pass);
    format(str3, sizeof(str3), "%d", strval(value));
    }

    if (strfind(passres, str2) != -1)
    {
    value = GetFileValue(pass);
    format(str4, sizeof(str4), "%d", strval(value));
    }


    GivePlayerWeapon(playerid, str3, str4); //C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(670) : error 035: argument type mismatch (argument 2)


    }
    Wäre schön wenn schnell eine Antwort kommt :)

  • GivePlayerWeapon(playerid, strval(str3), strval(str4));


    Der String muss erst in einen integer konvertiert werden.

  • oh geil, geht vielen vielen dank =)


    eine frage noch, wieso kommt das bei den fehlern:
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(520) : warning 217: loose indentation
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(581) : warning 217: loose indentation
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(652) : warning 215: expression has no effect
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(788) : warning 217: loose indentation
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(848) : warning 217: loose indentation
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(1150) : warning 217: loose indentation
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(1296) : warning 215: expression has no effect
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(1302) : warning 215: expression has no effect
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(1310) : warning 215: expression has no effect
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(1328) : warning 217: loose indentation
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(1352) : warning 215: expression has no effect
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(1373) : warning 217: loose indentation
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(3901) : warning 215: expression has no effect
    C:\Dokumente und Einstellungen\Logan\Desktop\GTA SA Server\gamemodes\copandrob.pwn(3951) : warning 217: loose indentation
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    14 Warnings.

  • Quellcode bitte, ohne können wir dir schlecht weiterhelfen.

  • oh nein, mein nächstes problem -.-


    er gibt mir dir waffen nicht....
    abspeichern:
    public OnPlayerUpdateAccount(playerid)
    {
    if(IsPlayerConnected(playerid))
    {
    if(AccountInfo[playerid][Logged] == 1)
    {
    new name[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "/Accounts/%s.script", name);
    new File:account = fopen(str, io_write);
    if (account)
    {
    AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
    AccountInfo[playerid][Weapon] = GetPlayerWeapon(playerid);
    AccountInfo[playerid][Wanteds] = GetPlayerWantedLevel(playerid);
    new file[128];
    {
    format(file, sizeof file, "Password: %s\n\r", AccountInfo[playerid][Password]);
    { fwrite(account, file); }
    format(file, sizeof file, "AdminLevel: %d\n\r",AccountInfo[playerid][AdminLevel]);
    { fwrite(account, file); }
    format(file, sizeof file, "Cash: %d\n\r", AccountInfo[playerid][Cash]);
    { fwrite(account, file); }

    new weapons[13][2];


    for (new i = 0; i < 13; i++)
    {


    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);


    AccountInfo[playerid][Weapon] = weapons[i][0];


    AccountInfo[playerid][Ammo] = weapons[i][1];


    format(file, sizeof file, "Weapon%d: %d\n", i, AccountInfo[playerid][Weapon]);
    { fwrite(account, file); }
    format(file, sizeof file, "Ammo%d: %d\n\r", i, AccountInfo[playerid][Ammo]);
    { fwrite(account, file); }
    }

    format(file, sizeof file, "Wanteds: %d\n\r", AccountInfo[playerid][Wanteds]);
    { fwrite(account, file); }
    format(file, sizeof file, "Warnings: %d\n\r",AccountInfo[playerid][Warns]);
    { fwrite(account, file); }
    format(file, sizeof file, "WarnReason1: %s\n\r",AccountInfo[playerid][WarnReason1]);
    { fwrite(account, file); }
    format(file, sizeof file, "WarnReason2: %s\n\r",AccountInfo[playerid][WarnReason2]);
    { fwrite(account, file); }
    format(file, sizeof file, "WarnReason3: %s\n\r",AccountInfo[playerid][WarnReason3]);
    { fwrite(account, file); }
    format(file, sizeof file, "IPAddress: %s\n\r",AccountInfo[playerid][IP]);
    { fwrite(account, file); }
    }
    fclose(account);
    }
    }
    }
    return 1;
    }



    rausholen:
    public OnPlayerLogin(playerid, password[])
    {
    new name[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "/Accounts/%s.script", name);

    new File:account = fopen(str, io_read);
    if (account)
    {
    new pass[256];
    new passres[128], value[128];
    fread(account, pass, sizeof pass);
    passres = GetFileString(pass);
    if (!strcmp("Password", passres))
    {
    value = GetFileValue(pass);
    strmid(AccountInfo[playerid][Password], value, 0, strlen(value)-1, 128);
    }
    if (!strcmp(AccountInfo[playerid][Password], password, true))
    {
    while (fread(account, pass, 256))
    {
    passres = GetFileString(pass);
    if (strfind(passres, "AdminLevel") != -1)
    {
    value = GetFileValue(pass);
    AccountInfo[playerid][AdminLevel] = strval(value);
    }
    if (strfind(passres, "Cash") != -1)
    {
    value = GetFileValue(pass);
    AccountInfo[playerid][Cash] = strval(value);
    }
    if (strfind(passres, "Wanteds") != -1)
    {
    value = GetFileValue(pass);
    AccountInfo[playerid][Wanteds] = strval(value);
    }

    ResetPlayerWeapons(playerid);
    new i;
    new str1[20];
    new str2[20];
    new str3[5];
    new str4[5];
    for(i; i<13; i++)
    {
    format(str1, sizeof(str1), "Weapon%d", i);
    format(str2, sizeof(str2), "Ammo%d", i);

    if (strfind(passres, str1) != -1)
    {
    value = GetFileValue(pass);
    format(str3, sizeof(str3), "%d", strval(value));
    }

    if (strfind(passres, str2) != -1)
    {
    value = GetFileValue(pass);
    format(str4, sizeof(str4), "%d", strval(value));
    }


    GivePlayerWeapon(playerid, strval(str3), strval(str4));


    }




    if (strfind(passres, "Warnings") != -1)
    {
    value = GetFileValue(pass);
    AccountInfo[playerid][Warns] = strval(value);
    }
    if (strfind(passres, "WarnReason1") != -1)
    {
    value = GetFileValue(pass);
    strmid(AccountInfo[playerid][WarnReason1], value, 0, strlen(value)-1, 128);
    }
    if (strfind(passres, "WarnReason2") != -1)
    {
    value = GetFileValue(pass);
    strmid(AccountInfo[playerid][WarnReason2], value, 0, strlen(value)-1, 128);
    }
    if (strfind(passres, "WarnReason3") != -1)
    {
    value = GetFileValue(pass);
    strmid(AccountInfo[playerid][WarnReason3], value, 0, strlen(value)-1, 128);
    }
    }
    fclose(account);
    AccountInfo[playerid][Logged] = 1;
    }
    else
    {
    SendClientMessage(playerid, RED, "Falsches Passwort.");
    fclose(account);
    return 1;
    }
    GivePlayerMoney(playerid, AccountInfo[playerid][Cash]);
    format(str, sizeof str, "|- Du hast dich erfolgreich eingelogt mit %s -|", name);
    SendClientMessage(playerid, GREEN, str);
    printf("%s has logged in", name);
    if (AccountInfo[playerid][AdminLevel] > 0)
    {
    format(str, sizeof str, "|» Du bist jetzt eingelogt als level %d admin «|", AccountInfo[playerid][AdminLevel]);
    SendClientMessage(playerid, LIGHTGREEN, str);
    ViewCmds[playerid] = 0;
    }
    }
    return 1;
    }


    :cursing: