Beiträge von Daniel_Waynee

    forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
    public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
    {
    if(IsPlayerConnected(playerid))
    {
    new Float:posx, Float:posy, Float:posz;
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i) && !IsPlayerNPC(i) && i != INVALID_PLAYER_ID)
    {
    GetPlayerPos(i, posx, posy, posz);
    tempposx = (oldposx -posx);
    tempposy = (oldposy -posy);
    tempposz = (oldposz -posz);
    if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
    {
    SendClientMessage(i, col1, string);
    }
    else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
    {
    SendClientMessage(i, col2, string);
    }
    else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
    {
    SendClientMessage(i, col3, string);
    }
    else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
    {
    SendClientMessage(i, col4, string);
    }
    else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
    SendClientMessage(i, col5, string);
    }
    }
    }
    }
    return 1;
    }


    stock GetName(playerid){new name[MAX_PLAYER_NAME];GetPlayerName(playerid,name,MAX_PLAYER_NAME);return name;}

    ocmd:motor(playerid,params[])
    {
    new vid = GetPlayerVehicleID(playerid);
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(IsPlayerInAnyVehicle(playerid) && !IsAFahrrad(vid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
    {
    if(motor[vid] == false)
    {
    vehT[vid] = SetTimerEx("vehTimer",1000,true,"ii",vid,playerid);
    motor[vid] = true;
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~W~Motor wird ~g~gestartet!", 2000, 5);
    PlayerTextDrawShow(playerid,Tachobox[playerid]);
    PlayerTextDrawShow(playerid,Tachoname[playerid]);
    PlayerTextDrawShow(playerid,Tachokmh[playerid]);
    PlayerTextDrawShow(playerid,Tachotank[playerid]);
    PlayerTextDrawShow(playerid,Tachoart[playerid]);
    PlayerTextDrawShow(playerid,Tachot[playerid]);
    PlayerTextDrawShow(playerid,Tachom[playerid]);
    PlayerTextDrawShow(playerid,Tachol[playerid]);
    }
    else
    {
    KillTimer(vehT[vid]);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    motor[vid] = false;
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~W~Motor wird ~r~gestoppt!", 2000, 5);
    PlayerTextDrawHide(playerid,Tachobox[playerid]);
    PlayerTextDrawHide(playerid,Tachoname[playerid]);
    PlayerTextDrawHide(playerid,Tachokmh[playerid]);
    PlayerTextDrawHide(playerid,Tachotank[playerid]);
    PlayerTextDrawHide(playerid,Tachoart[playerid]);
    PlayerTextDrawHide(playerid,Tachot[playerid]);
    PlayerTextDrawHide(playerid,Tachom[playerid]);
    PlayerTextDrawHide(playerid,Tachol[playerid]);
    }
    }
    return 1;
    }

    Hallo ich bekomme immer ein error wenn ich mein Motor anmache und der Timer startet.


    HIER DER ERROR:


    [21:24:06] [debug] Run time error 4: "Array index out of bounds"
    [21:24:06] [debug] Accessing element at negative index -400
    [21:24:06] [debug] AMX backtrace:
    [21:24:06] [debug] #0 000414b8 in public vehTimer (7, 0) from selfmade.amx


    HIER DER TIMER:


    forward vehTimer(playerid,vehicleid);
    public vehTimer(playerid,vehicleid)
    {
    new string[220];
    //FAHRZEUGNAME
    format(string,sizeof(string),"%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]);
    PlayerTextDrawSetString(playerid,Tachoname[playerid],string);
    //KMH
    format(string,sizeof(string),"Geschwindigkeit: %i Km/H",getPlayerSpeed(playerid));
    PlayerTextDrawSetString(playerid,Tachokmh[playerid],string);
    //TANK
    format(string,sizeof(string),"Tank: %i/%i L",Tankmenge[GetPlayerVehicleID(playerid)],GasMax[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    PlayerTextDrawSetString(playerid,Tachotank[playerid],string);
    //TANKART
    format(string,sizeof(string),"Treibstoff: %s",Gasname(GetPlayerVehicleID(playerid)));
    PlayerTextDrawSetString(playerid,Tachoart[playerid],string);
    //MOTOR
    if(motor[GetPlayerVehicleID(playerid)] == false)
    {
    PlayerTextDrawColor(playerid,Tachom[playerid],rot);
    }
    else
    {
    PlayerTextDrawColor(playerid,Tachom[playerid],grün);
    }
    return 1;
    }

    ocmd:setfrank(playerid,params[])
    {
    new rID,name[50],string[200];
    if(sInfo[playerid][Rank] < 11)return SendClientMessage(playerid,rot,"Du bist nicht der Leader");
    if(sscanf(params,"is[50]",rID,name)) return SendClientMessage(playerid,rot,"Verwendung: /setfrank [Rank 1-12] [Name]");
    if(rID <= 0 || rID > 12) return SendClientMessage(playerid,rot,"Der Rank muss zwischen 1-12 liegen!");
    new frak = sInfo[playerid][Fraktion]; //Hier sInfo evtl anpassen, da ich nicht den Namen für die Frak kenne
    format(fInfo[frak][fracEnum:(rID+8)],50,name);
    format(string,sizeof(string),"UPDATE `fraktion` SET `f_Rank%d`='%s' WHERE `id`='%d'",rID,name,fInfo[frak][f_id]); //Tabellennamen anpassen :)
    mysql_tquery(handle,string,"","");
    print(string);
    format(string,sizeof(string),"Du hast den Name von Rank: %i in %s geändert.",rID,name);
    SendClientMessage(playerid,grün,string);
    return 1;
    }

    ocmd:setfrank(playerid,params[])
    {
    new rID,name[50],string[200];
    if(sInfo[playerid][Rank] < 11)return SendClientMessage(playerid,rot,"Du bist nicht der Leader");
    if(sscanf(params,"is[50]",rID,name)) return SendClientMessage(playerid,rot,"Verwendung: /setfrank [Rank 1-12] [Name]");
    if(rID <= 0 || rID > 12) return SendClientMessage(playerid,rot,"Der Rank muss zwischen 1-12 liegen!");
    new frak = sInfo[playerid][Fraktion]; //Hier sInfo evtl anpassen, da ich nicht den Namen für die Frak kenne
    format(fInfo[frak][fracEnum:(rID+8)],50,name);
    format(string,sizeof(string),"UPDATE `fraktion` SET `f_Rank%d`='%s' WHERE `id`='%d'",rID,name,fInfo[frak][f_id]); //Tabellennamen anpassen :)
    mysql_tquery(handle,string,"","");
    format(string,sizeof(string),"Du hast den Name von Rank: %i in %s geändert.",rID,name);
    SendClientMessage(playerid,grün,string);
    return 1;
    }

    Klar


    enum fracEnum {


    f_id,
    f_name[128],
    Float:f_spawnX,
    Float:f_spawnY,
    Float:f_spawnZ,
    Float:f_spawnR,
    f_int,
    f_world,
    f_skin,
    f_Rank1[50],
    f_Rank2[50],
    f_Rank3[50],
    f_Rank4[50],
    f_Rank5[50],
    f_Rank6[50],
    f_Rank7[50],
    f_Rank8[50],
    f_Rank9[50],
    f_Rank10[50],
    f_Rank11[50],
    f_Rank12[50]
    }