1 Error :/

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
  • Zitat

    C:\Dokumente und Einstellungen\dani\Desktop\dm.pwn(789) : error 047: array sizes do not match, or destination array is too small



    dcmd_v(playerid, params[]) {
    new idx, iString[128];
    iString = strtok(params, idx); //-------------<==HIER
    if (gPlayerStatus[playerid] != 0) {
    format(iString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]);
    SendClientMessage(playerid, COLOR_RED, iString);
    return true;
    }


    if (!strlen(iString)) {
    SendClientMessage(playerid, COLOR_RED, "[USAGE]: /v MODELID/NAME or /vehicle MODELID/NAME");
    return true;
    }


    idx = GetVehicleModelIDFromName(params[1]);


    if(idx == -1) {
    idx = strval(iString);


    if (idx < MIN_VEHI_ID || idx > MAX_VEHI_ID) {
    SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid MODELID/NAME");
    return true;
    }
    }


    new Float:x, Float:y, Float:z, Float:a;


    GetPlayerPos(playerid, x, y, z);
    GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS);
    GetPlayerFacingAngle(playerid, a);


    curPlayerVehM[playerid] = idx;


    curPlayerVehI[playerid] = CreateVehicle(idx, x, y, z + 2.0, a + 90.0, -1, -1, 5000);
    LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid));


    curServerVehP[curPlayerVehI[playerid]][spawn] = true;
    curServerVehP[curPlayerVehI[playerid]][vmodel] = idx;
    curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid);


    format(iString, 128, "[SUCCESS]: Spawned a \"%s\" (MODELID: %d, VEHICLEID: %d)", aVehicleNames[idx - MIN_VEHI_ID], idx, curPlayerVehI[playerid]);


    SendClientMessage(playerid, COLOR_GREEN, iString);


    return true;
    }

  • habe farkeine strtok im script aber wenn ich


    strtok(const string[], &index)
    { // Created by Compuphase


    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
    index++;
    }


    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
    result[index - offset] = string[index];
    index++;
    }
    result[index - offset] = EOS;
    return result;
    }




    Rein mach dann


    C:\Dokumente und Einstellungen\dani\Desktop\dm.pwn(789) : error 047: array sizes do not match, or destination array is too small
    C:\Dokumente und Einstellungen\dani\Desktop\dm.pwn(919) : error 021: symbol already defined: "strtok"
    C:\Dokumente und Einstellungen\dani\Desktop\dm.pwn(935) : error 047: array sizes do not match, or destination array is too small
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    3 Errors.



    dcmd_v(playerid, params[]) {
    new idx, iString[128];
    /*789*/ iString = strtok(params, idx);
    if (gPlayerStatus[playerid] != 0) {
    format(iString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]);
    SendClientMessage(playerid, COLOR_RED, iString);
    return true;
    }


    if (!strlen(iString)) {
    SendClientMessage(playerid, COLOR_RED, "[USAGE]: /v MODELID/NAME or /vehicle MODELID/NAME");
    return true;
    }


    idx = GetVehicleModelIDFromName(params[1]);


    if(idx == -1) {
    idx = strval(iString);


    if (idx < MIN_VEHI_ID || idx > MAX_VEHI_ID) {
    SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid MODELID/NAME");
    return true;
    }
    }


    new Float:x, Float:y, Float:z, Float:a;


    GetPlayerPos(playerid, x, y, z);
    GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS);
    GetPlayerFacingAngle(playerid, a);


    curPlayerVehM[playerid] = idx;


    curPlayerVehI[playerid] = CreateVehicle(idx, x, y, z + 2.0, a + 90.0, -1, -1, 5000);
    LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid));


    curServerVehP[curPlayerVehI[playerid]][spawn] = true;
    curServerVehP[curPlayerVehI[playerid]][vmodel] = idx;
    curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid);


    format(iString, 128, "[SUCCESS]: Spawned a \"%s\" (MODELID: %d, VEHICLEID: %d)", aVehicleNames[idx - MIN_VEHI_ID], idx, curPlayerVehI[playerid]);


    SendClientMessage(playerid, COLOR_GREEN, iString);


    return true;
    }



    des anderer liegt dann an strtok

  • dcmd_v(playerid, params[]) {
    new idx, iString[256];
    iString = strtok(params, idx); //-------------<==HIER
    if (gPlayerStatus[playerid] != 0) {
    format(iString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]);
    SendClientMessage(playerid, COLOR_RED, iString);
    return true;
    }


    if (!strlen(iString)) {
    SendClientMessage(playerid, COLOR_RED, "[USAGE]: /v MODELID/NAME or /vehicle MODELID/NAME");
    return true;
    }


    idx = GetVehicleModelIDFromName(params[1]);


    if(idx == -1) {
    idx = strval(iString);


    if (idx < MIN_VEHI_ID || idx > MAX_VEHI_ID) {
    SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid MODELID/NAME");
    return true;
    }
    }


    new Float:x, Float:y, Float:z, Float:a;


    GetPlayerPos(playerid, x, y, z);
    GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS);
    GetPlayerFacingAngle(playerid, a);


    curPlayerVehM[playerid] = idx;


    curPlayerVehI[playerid] = CreateVehicle(idx, x, y, z + 2.0, a + 90.0, -1, -1, 5000);
    LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid));


    curServerVehP[curPlayerVehI[playerid]][spawn] = true;
    curServerVehP[curPlayerVehI[playerid]][vmodel] = idx;
    curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid);


    format(iString, 128, "[SUCCESS]: Spawned a \"%s\" (MODELID: %d, VEHICLEID: %d)", aVehicleNames[idx - MIN_VEHI_ID], idx, curPlayerVehI[playerid]);


    SendClientMessage(playerid, COLOR_GREEN, iString);


    return true;
    }


    Probier dass ma so