Другое SAMPFUNCS | API C++

Cake_

Известный
Проверенный
263
313
Lua:
function Search3Dtext(x, y, z, radius, patern)
    local text = ""
    local color = 0
    local posX = 0.0
    local posY = 0.0
    local posZ = 0.0
    local distance = 0.0
    local ignoreWalls = false
    local player = -1
    local vehicle = -1
    local result = false

    for id = 0, 2048 do
        if sampIs3dTextDefined(id) then
            local text2, color2, posX2, posY2, posZ2, distance2, ignoreWalls2, player2, vehicle2 = sampGet3dTextInfoById(id)
            if getDistanceBetweenCoords3d(x, y, z, posX2, posY2, posZ2) < radius then
                if string.len(patern) ~= 0 then
                    if string.match(text2, patern, 0) ~= nil then result = true end
                else
                    result = true
                end
                if result then
                    text = text2
                    color = color2
                    posX = posX2
                    posY = posY2
                    posZ = posZ2
                    distance = distance2
                    ignoreWalls = ignoreWalls2
                    player = player2
                    vehicle = vehicle2
                    radius = getDistanceBetweenCoords3d(x, y, z, posX, posY, posZ)
                end
            end
        end
    end

    return result, text, color, posX, posY, posZ, distance, ignoreWalls, player, vehicle
end
На сф есть у кого-то?
Что не так?

C++:
for (int i = 0; i < SAMP_MAX_3DTEXTS; i++)
    {
        char stroka[256];

        if (SF->getSAMP()->getInfo()->pPools->pText3D->iIsListed[i] != 1)
            continue;

        if (SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].fPosition[0] == NULL ||
            SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].fPosition[1] == NULL ||
            SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].fPosition[2] == NULL) {
            continue;
        }
        stroka = SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].pText;
    }
 

Revalto

Известный
532
225
Lua:
function Search3Dtext(x, y, z, radius, patern)
    local text = ""
    local color = 0
    local posX = 0.0
    local posY = 0.0
    local posZ = 0.0
    local distance = 0.0
    local ignoreWalls = false
    local player = -1
    local vehicle = -1
    local result = false

    for id = 0, 2048 do
        if sampIs3dTextDefined(id) then
            local text2, color2, posX2, posY2, posZ2, distance2, ignoreWalls2, player2, vehicle2 = sampGet3dTextInfoById(id)
            if getDistanceBetweenCoords3d(x, y, z, posX2, posY2, posZ2) < radius then
                if string.len(patern) ~= 0 then
                    if string.match(text2, patern, 0) ~= nil then result = true end
                else
                    result = true
                end
                if result then
                    text = text2
                    color = color2
                    posX = posX2
                    posY = posY2
                    posZ = posZ2
                    distance = distance2
                    ignoreWalls = ignoreWalls2
                    player = player2
                    vehicle = vehicle2
                    radius = getDistanceBetweenCoords3d(x, y, z, posX, posY, posZ)
                end
            end
        end
    end

    return result, text, color, posX, posY, posZ, distance, ignoreWalls, player, vehicle
end
На сф есть у кого-то?
Что не так?

C++:
for (int i = 0; i < SAMP_MAX_3DTEXTS; i++)
    {
        char stroka[256];

        if (SF->getSAMP()->getInfo()->pPools->pText3D->iIsListed[i] != 1)
            continue;

        if (SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].fPosition[0] == NULL ||
            SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].fPosition[1] == NULL ||
            SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].fPosition[2] == NULL) {
            continue;
        }
        stroka = SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].pText;
    }
Код:
for (int i = 0; i < SAMP_MAX_3DTEXTS; i++)
        {
            if (SF->getSAMP()->getInfo()->pPools->pText3D->iIsListed[i] != 1)
                continue;

          
            string texts = SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].pText;

            float x = SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].fPosition[0];
            float y = SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].fPosition[1];
            float z = SF->getSAMP()->getInfo()->pPools->pText3D->textLabel[i].fPosition[2];
        }
 

LaRossa

Потрачен
429
117
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Как сделать, чтобы плагин сам себя выгрузил типо pfree
 

-raymond-

Известный
110
9
можно ли средствами сф заставить авто в котором я сижу на месте водилы двигаться в заданные координаты? если нет то я думаю можно эмулировать клавишу, или есть способы попроще?
 

LaRossa

Потрачен
429
117
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Подскажите, как это будет в SF
C++:
018C: play_sound 1082 at 0.0 0.0 0.0
 

Cake_

Известный
Проверенный
263
313
Подскажите, как это будет в SF
C++:
018C: play_sound 1082 at 0.0 0.0 0.0
BASS.lib ,https://blast.hk/threads/34405/


Подскажите, как это будет в SF
C++:
018C: play_sound 1082 at 0.0 0.0 0.0
C++:
void playsound(uint16_t id, const CVector* position)
{
    ((int(__thiscall*) (uintptr_t* ptr, uint16_t soundId, const CVector* position)) (0x507340)) ((uintptr_t*)0xB6BC90, id, position);
}
 
  • Нравится
Реакции: LaRossa

-raymond-

Известный
110
9
как в сф прицепить к фуре в которой я сижу прицеп?

как эмулировать клавишу H находясь в машине чтобы сработал onplayerkeystatechange?
 
Последнее редактирование модератором:

Vesca

Новичок
20
0
How to get the name of the vehicle I enter in?

How to parse the text (and add things) before sending it via T > {enter}?
 

Rjx13

Известный
Проверенный
224
160
How to get the name of the vehicle I enter in?
Code by @Mozze.cpp

GetVehicleName(-1) = vehicle local player
C++:
CHAR Vehicles[][212] = {
    { "Landstalker" },
    { "Bravura" },
    { "Buffalo" },
    { "Linerunner" },
    { "Perrenial" },
    { "Sentinel" },
    { "Dumper" },
    { "Firetruck" },
    { "Trashmaster" },
    { "Stretch" },
    { "Manana" },
    { "Infernus" },
    { "Voodoo" },
    { "Pony" },
    { "Mule" },
    { "Cheetah" },
    { "Ambulance" },
    { "Leviathan" },
    { "Moonbeam" },
    { "Esperanto" },
    { "Taxi" },
    { "Washington" },
    { "Bobcat" },
    { "MrWhoopee" },
    { "BFInjection" },
    { "Hunter" },
    { "Premier" },
    { "Enforcer" },
    { "Securicar" },
    { "Banshee" },
    { "Predator" },
    { "Bus" },
    { "Rhino" },
    { "Barracks" },
    { "Hotknife" },
    { "Trailer1" },
    { "Previon" },
    { "Coach" },
    { "Cabbie" },
    { "Stallion" },
    { "Rumpo" },
    { "RCBandit" },
    { "Romero" },
    { "Packer" },
    { "Monster" },
    { "Admiral" },
    { "Squalo" },
    { "Seasparrow" },
    { "Pizzaboy" },
    { "Tram" },
    { "Trailer2" },
    { "Turismo" },
    { "Speeder" },
    { "Reefer" },
    { "Tropic" },
    { "Flatbed" },
    { "Yankee" },
    { "Caddy" },
    { "Solair" },
    { "BerkleyRCVan" },
    { "Skimmer" },
    { "PCJ-600" },
    { "Faggio" },
    { "Freeway" },
    { "RCBaron" },
    { "RCRaider" },
    { "Glendale" },
    { "Oceanic" },
    { "Sanchez" },
    { "Sparrow" },
    { "Patriot" },
    { "Quad" },
    { "Coastguard" },
    { "Dinghy" },
    { "Hermes" },
    { "Sabre" },
    { "Rustler" },
    { "ZR-350" },
    { "Walton" },
    { "Regina" },
    { "Comet" },
    { "BMX" },
    { "Burrito" },
    { "Camper" },
    { "Marquis" },
    { "Baggage" },
    { "Dozer" },
    { "Maverick" },
    { "NewsChopper" },
    { "Rancher" },
    { "FBIRancher" },
    { "Virgo" },
    { "Greenwood" },
    { "Jetmax" },
    { "Hotring" },
    { "Sandking" },
    { "Blista Compact" },
    { "Police Maverick" },
    { "Boxville" },
    { "Benson" },
    { "Mesa" },
    { "RCGoblin" },
    { "HotringRacer A" },
    { "HotringRacer B" },
    { "BloodringBanger" },
    { "Rancher" },
    { "SuperGT" },
    { "Elegant" },
    { "Journey" },
    { "Bike" },
    { "MountainBike" },
    { "Beagle" },
    { "Cropdust" },
    { "Stunt" },
    { "Tanker" },
    { "Roadtrain" },
    { "Nebula" },
    { "Majestic" },
    { "Buccaneer" },
    { "Shamal" },
    { "Hydra" },
    { "FCR-900" },
    { "NRG-500" },
    { "HPV1000" },
    { "CementTruck" },
    { "TowTruck" },
    { "Fortune" },
    { "Cadrona" },
    { "FBITruck" },
    { "Willard" },
    { "Forklift" },
    { "Tractor" },
    { "Combine" },
    { "Feltzer" },
    { "Remington" },
    { "Slamvan" },
    { "Blade" },
    { "Freight" },
    { "Streak" },
    { "Vortex" },
    { "Vincent" },
    { "Bullet" },
    { "Clover" },
    { "Sadler" },
    { "FiretruckLA" },
    { "Hustler" },
    { "Intruder" },
    { "Primo" },
    { "Cargobob" },
    { "Tampa" },
    { "Sunrise" },
    { "Merit" },
    { "Utility" },
    { "Nevada" },
    { "Yosemite" },
    { "Windsor" },
    { "MonsterA" },
    { "MonsterB" },
    { "Uranus" },
    { "Jester" },
    { "Sultan" },
    { "Stratum" },
    { "Elegy" },
    { "Raindance" },
    { "RC Tiger" },
    { "Flash" },
    { "Tahoma" },
    { "Savanna" },
    { "Bandito" },
    { "FreightFlat" },
    { "StreakCarriage" },
    { "Kart" },
    { "Mower" },
    { "Duneride" },
    { "Sweeper" },
    { "Broadway" },
    { "Tornado" },
    { "AT-400" },
    { "DFT-30" },
    { "Huntley" },
    { "Stafford" },
    { "BF-400" },
    { "Newsvan" },
    { "Tug" },
    { "Trailer 3" },
    { "Emperor" },
    { "Wayfarer" },
    { "Euros" },
    { "Hotdog" },
    { "Club" },
    { "FreightCarriage" },
    { "Trailer3" },
    { "Andromada" },
    { "Dodo" },
    { "RCCam" },
    { "Launch" },
    { "PoliceCar(LSPD)" },
    { "PoliceCar(SFPD)" },
    { "PoliceCar(LVPD)" },
    { "PoliceRanger" },
    { "Picador" },
    { "S.W.A.T.Van" },
    { "Alpha" },
    { "Phoenix" },
    { "Glendale" },
    { "Sadler" },
    { "LuggageTrailerA" },
    { "LuggageTrailerB" },
    { "StairTrailer" },
    { "Boxville" },
    { "FarmPlow" },
    { "UtilityTrailer" }
};

CONST CHAR* GetVehicleName(INT ID = -1)
{
    if (ID == -1)
    {
        if (SF->getSAMP()->getVehicles()->pSAMP_Vehicle[SF->getSAMP()->getPlayers()->pLocalPlayer->inCarData.sVehicleID] == NULL) return "";
        if (SF->getSAMP()->getVehicles()->pSAMP_Vehicle[SF->getSAMP()->getPlayers()->pLocalPlayer->inCarData.sVehicleID]->pGTA_Vehicle == NULL) return "";

        return Vehicles[SF->getSAMP()->getVehicles()->pSAMP_Vehicle[SF->getSAMP()->getPlayers()->pLocalPlayer->inCarData.sVehicleID]->pGTA_Vehicle->base.model_alt_id - 400];
    }
    else
    {
        if (SF->getSAMP()->getVehicles()->pSAMP_Vehicle[ID] == NULL) return "";
        if (SF->getSAMP()->getVehicles()->pSAMP_Vehicle[ID]->pGTA_Vehicle == NULL) return "";

        return Weapons[SF->getSAMP()->getPlayers()->pRemotePlayer[ID]->pPlayerData->onFootData.byteCurrentWeapon];
    }
}

How to parse the text (and add things) before sending it via T > {enter}?
You need hook Outcoming RPC:
- RPC_Chat (101)
- RPC_ServerCommand (50)