Jump to content

mrrares19

Membru
  • Posts

    66
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by mrrares19

  1. pentru ce-i ce nu au rezolvat

    stock-ul

    stock DestroyPlayerCar(dbid, bool:useinloop = false) {
        if(CarInfo[dbid][Spawned] == 0) return true;
       
        VehicleOwned[CarInfo[dbid][Spawned]] = 0;
        VehicleSQL[CarInfo[dbid][Spawned]] = 0;
        CarInfo[dbid][cTime] = -1;
        gQuery[0] = EOS;
           
        new Float: Pos[3];
        GetVehiclePos(CarInfo[dbid][Spawned], Pos[0], Pos[1], Pos[2]);
        if(strlen(CarInfo[dbid][cText]) >= 3) DestroyDynamicObject(nameobject[CarInfo[dbid][Spawned]]);
        if(CarInfo[dbid][cNeon]) for(new i = 0; i < 2; i++) DestroyDynamicObject(NeonObj[i][CarInfo[dbid][Spawned]]);
        if(!useinloop) Iter_Remove(PersonalVSpawned, dbid);
     
        MyVehicleSpawn[CarInfo[dbid][cOnline]] --;
        CarInfo[dbid][cFuel] = Gas[CarInfo[dbid][Spawned]];
        mysql_format(SQL, gQuery, sizeof(gQuery), "UPDATE `cars` SET `Fuel`='%d' WHERE `ID`='%d'", CarInfo[dbid][cFuel], CarInfo[dbid][cID]);
        mysql_tquery(SQL, gQuery, "", "");
     
        for(new i = 0; i < 3; i++) CarInfo[dbid][cLastPos][i] = Pos[i];
        DestroyVehicle(CarInfo[dbid][Spawned]);
        CarInfo[dbid][Spawned] = 0;
        saveCar(dbid);
     
        mysql_format(SQL, gQuery, sizeof gQuery , "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[dbid][Spawned], CarInfo[dbid][cID]);
        mysql_tquery(SQL, gQuery, "", "");
        return true;
    }
     
    linia din decreasetimer: 
     
     foreach(new idd: PersonalVSpawned) {
            if(CarInfo[idd][cTime] < gettime() && CarInfo[idd][cTime] != -1) {
                DestroyPlayerCar(idd, true);
                Iter_Remove(PersonalVSpawned, idd);
            }
        }
     
  2. 7 hours ago, Sancky said:

    CMD:me(playerid, text[]) 
    {
        new message[116];

        if(strlen(text) > 116 || sscanf(text, "s[116]", message)) 
            return 1;
            
        new playerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
        
        format(message, sizeof message, "> %s %s", playerName, message);

        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);

        for(new i = 0; i < MAX_PLAYERS; ++i)
        {      
            if(IsPlayerInRangeOfPoint(i, 6.0, x, y, z))
                SendClientMessage(i, COLOR_PURPLE, message);
        }
        return 1;
    }

     

    incearca asa, dar nu stiu sigur daca va merge formatarea aia pe acelasi array, daca nu mg definesti alt array si il formatezi p-ala

    CMD:me(playerid, params[], help) {
        extract params -> new string:text[128]; else return SendClientMessage(playerid, COLOR_WHITE, "me [text]");
     
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
     
        for(new i = 0; i < MAX_PLAYERS; ++i) if(IsPlayerInRangeOfPoint(i, 15.0, x, y, z)) va_SendClientMessage(i, COLOR_PURPLE, "%s say %s", GetName(playerid), text);
        return true;
    }
  3. 1 hour ago, khain.dev said:

    Optimizăm putin codul
     

    CMD:fly(playerid, params[])
    {
        if(!IsPlayerConnected(playerid)) return 0; // Verificăm dacă jucătorul este conectat
    
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie să te conectezi.");
            return 1;
        }
    
        if(PlayerInfo[playerid][pAdmin] < 1)
        {
            SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
            return 1;
        }
    
        new sendername[MAX_PLAYER_NAME], string[256];
    
        GetPlayerName(playerid, sendername, sizeof(sendername));
    
        if(flymode[playerid] == 0)
        {
            togfind[playerid] = 0;
            flymode[playerid] = 1;
    
            format(string, sizeof(string), "{DFF230}%s este acum în modul fly-mode.", sendername);
            ABroadCast(COLOR_ORANGE, string, 1);
    
            InitFly(playerid);
            StartFly(playerid);
            SetPlayerHealthEx(playerid, 10000000);
        }
        else
        {
            togfind[playerid] = 1;
            flymode[playerid] = 0;
    
            format(string, sizeof(string), "{F89AD6}Ai oprit fly-mode-ul", sendername);
            SCM(playerid, COLOR_GREEN, string);
    
            StopFly(playerid);
            SetPlayerHealthEx(playerid, 100);
        }
    
        return 1;
    }

     

    CMD:fly(playerid, params[]) {
        if(!PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_ERROR, "Nu esti autorizat sa folosesti aceasta comanda!");
       
        switch(flymode[playerid]) {
            case 0: {
                togfind[playerid] = 0; flymode[playerid] = 1;
     
                gString[0] = EOS;  
                format(gString, sizeof(gString), "{DFF230}%s este acum în modul fly-mode.", GetName(playerid));
                ABroadCast(COLOR_ORANGE, gString, 1);
     
                InitFly(playerid); StartFly(playerid);
                SetPlayerHealthEx(playerid, 10000000);
            }
            case 1: {
                togfind[playerid] = 1; flymode[playerid] = 0;
     
                va_SendClientMessage(playerid, COLOR_GREEN, "{F89AD6}Ai oprit fly-mode-ul", GetName(playerid));
     
                StopFly(playerid);
                SetPlayerHealthEx(playerid, 100);
            }
        }
        return 1;
    }
  4. YCMD:carplate(playerid, params[], help) {
        extract params -> new string:plate[12]; else return SendUsageMsg(playerid, "carplate [car plate]");
        if(PersonalCar(playerid) == -1) return SendErrorMsg(playerid, "Nu esti in unul dintre vehiculele tale personale!");
        if(!(0 <= strlen(plate) <= 10)) return SendErrorMsg(playerid, "Numarul de inmatriculare poate avea maxim 10 caractere!");
        if(strfind(plate, "'", true) != -1 || strfind(plate, "Model", true) != -1 || strfind(plate, "`", true) != -1) return SendErrorMsg(playerid, "Caractere invalide!");
     
        SetVehicleNumberPlate(CarInfo[PersonalCar(playerid)][Spawned], plate);
        SendClientMessage(playerid, COLOR_LGREEN, "Numarul de inmatriculare a fost salvat. Acesta se va pune automat la urmatorul respawn al vehiculului");
     
        if(PlayerInfo[playerid][pPremiumAccount] != 0) format(CarInfo[PersonalCar(playerid)][cLicense], 100, "{FF0000}%s", plate);
        if(PlayerInfo[playerid][pVip] != 0) format(CarInfo[PersonalCar(playerid)][cLicense], 100, "{F0B548}%s", plate);
        else format(CarInfo[PersonalCar(playerid)][cLicense], 100, "%s", plate);
     
        gQuery[0] = EOS;
        mysql_format(SQL, gQuery, sizeof gQuery, "UPDATE cars SET License='%s' WHERE ID=%d", plate, CarInfo[PersonalCar(playerid)][cID]);
        mysql_tquery(SQL, gQuery, "", "");
        return true;
    }                 
     
     
    pentru ce i ce nu stiu sa rezolve aceast bug din aceasta comanda!
  5. [debug] Run time error 4: "Array index out of bounds"
    [debug]  Attempted to read/write array element at index 101 in array of size 101
    [debug] AMX backtrace:
    [debug] #0 00344398 in public DecreaseTimer () at mrx.pwn:30372

    30372:  foreach(PersonalVSpawned, idd) if(CarInfo[idd][cTime] < gettime() && CarInfo[idd][cTime] != -1) DestroyPlayerCar(idd);   

    stock-ul in caz ca e nevoie:

    stock DestroyPlayerCar(dbid) {
        if(CarInfo[dbid][Spawned] == 0) return true;
        
        VehicleOwned[CarInfo[dbid][Spawned]] = 0;
        VehicleSQL[CarInfo[dbid][Spawned]] = 0;
        CarInfo[dbid][cTime] = -1;
            
        new Float: Pos[3];
        GetVehiclePos(CarInfo[dbid][Spawned], Pos[0], Pos[1], Pos[2]);
        if(strlen(CarInfo[dbid][cText]) >= 3) DestroyDynamicObject(nameobject[CarInfo[dbid][Spawned]]);
        if(CarInfo[dbid][cNeon]) {
            DestroyDynamicObject(NeonObj[0][CarInfo[dbid][Spawned]]);
            DestroyDynamicObject(NeonObj[1][CarInfo[dbid][Spawned]]);
        }
        Iter_Remove(PersonalVSpawned, dbid);
        MyVehicleSpawn[CarInfo[dbid][cOnline]] --;
        CarInfo[dbid][cFuel] = Gas[CarInfo[dbid][Spawned]];
        mysql_format(SQL, gQuery, sizeof(gQuery), "UPDATE `cars` SET `Fuel`='%d' WHERE `ID`='%d'", CarInfo[dbid][cFuel], CarInfo[dbid][cID]);
        mysql_tquery(SQL, gQuery, "", "");

        CarInfo[dbid][cLastPos][0] = Pos[0];
        CarInfo[dbid][cLastPos][1] = Pos[1];
        CarInfo[dbid][cLastPos][2] = Pos[2];    
            
        DestroyVehicle(CarInfo[dbid][Spawned]);
        CarInfo[dbid][Spawned] = 0;
        return true;
    }

    Va rog ajutati-ma ,nu scap de eroarea asta de 1 luna !

     

  6. [debug] AMX backtrace:
    [debug] #0 00222df0 in public @_yCgivehouse (playerid=0, params[]=@028f96dc "1 1", __help=0) at mrx.pwn:16893
    [debug] #1 00222b2c in public @yC_givehouse (0, 42964700, 0, 0)  at mrx.pwn:16887
    [debug] #2 native CallRemoteFunction () in samp-server.exe
    [debug] #3 0003af78 in Command_Process (playerid=0, cmdtext[]=@028f96a0 "/givehouse", help=0) at C:\Users\Mrx Rarez\Desktop\Mrx-Main\Execute Compiler\include\YSI\y_commands.inc:2499
    [debug] #4 0003a658 in ?? (0, 42964640) at C:\Users\Mrx Rarez\Desktop\Mrx-Main\Execute Compiler\include\YSI\y_commands.inc:2297
    [debug] #5 0002a1b0 in public OnPlayerCommandText (playerid=0, cmdtext[]=@028f96a0 "/givehouse") at C:\Users\Mrx Rarez\Desktop\Mrx-Main\Execute Compiler\include\YSI\y_hooks/impl.inc:946

     

    YCMD:givehouse(playerid, params[], help) {
        new house, id, query[256], string[180];
        if(PlayerInfo[playerid][pAdmin] < 7) return true;
        if(sscanf(params, "ud", id, house)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/givehouse <playerid/name> <house id>");
        mysql_format(SQL, query, sizeof(query), "UPDATE `users` SET `House`='999' WHERE `House`='%d'", id);
        mysql_tquery(SQL, query, "", "");
        PlayerInfo[id][pHouse] = house;
        format(query, sizeof(query), "UPDATE `users` SET `House`='%d' WHERE `ID`='%d'", house, PlayerInfo[id][pSQLID]);
        mysql_tquery(SQL, query, "", "");
        format(string, sizeof(string), "({FF0000}Admin Info{FFFFFF}) %s i-a dat lui %s(%d) casa %d.", GetName(playerid), GetName(id), id, house);
        SendAdminMessage(COLOR_WHITE, string, 1);
        format(string, sizeof(string), "Administratorul %s ti-a dat casa %d.", GetName(playerid), house);
        SendClientMessage(id, COLOR_YELLOW, string);
        HouseInfo[house][hOwned] = 1;
        format(HouseInfo[house][hOwner], 256, GetName(id));
        HouseInfo[house][hValue] = 0;
        UpdateLabel(1, house);
        mysql_format(SQL, query, sizeof(query), "UPDATE `houses` SET `Owned`='1', `Owner`='%s', `Value`='0' WHERE `ID`='%d'", GetName(id), house);
        mysql_tquery(SQL, query, "", "");
        return true;
    } nuj ce dracu are

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.