GTAMulti - GTA Türkiye

San Andreas Multiplayer => Yardım Talepleri => PAWN Kodlama => Kilitli Konular => Konuyu başlatan: Captian - 25 Kasım 2023, 18:06:06

Başlık: Sorun Çözüldi K/K
Gönderen: Captian - 25 Kasım 2023, 18:06:06
Sorun Çözüldi K/K
Başlık: Ynt: Araç Sistemi İle Alakalı Bir Sorun.
Gönderen: benHüseyin - 25 Kasım 2023, 19:03:57
PAWN Kodu: Seç
forward OnVehicleUpdate(vehicleid);

public OnVehicleUpdate(vehicleid)
{
    new Float:roll, Float:pitch, Float:yaw;
    GetVehicleRotation(vehicleid, roll, pitch, yaw);

    // Eğer araç ters döndüyse, onu düzelt
    if (pitch > 80.0 || pitch < -80.0)
    {
        SetVehicleHealth(vehicleid, 1000.0);
        SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
        SetVehicleRotation(vehicleid, roll, 0.0, yaw);
    }

    return 1;
}
Başlık: Ynt: Araç Sistemi İle Alakalı Bir Sorun.
Gönderen: Captian - 25 Kasım 2023, 19:15:29
(https://cdn.discordapp.com/attachments/1173918105349673013/1178006003040653442/image.png?ex=65749295&is=65621d95&hm=6bd3b4a21730805a15d4c5559f5517a843d8276b534e5862c6fb81572bcb35b2&) hata veriyor
Başlık: Ynt: Araç Sistemi İle Alakalı Bir Sorun.
Gönderen: benHüseyin - 25 Kasım 2023, 21:08:40
Eğer oyun modunuzda get set vehincle rotasyon infoları yoksa olmaz şöyle hata problem çözümleri.
// Bu fonksiyon, bir vektörü belirli bir derece (açı) kadar döndürür.



PAWN Kodu: Seç
forward Float:Float:vector_rotate(Float:Float:x, Float:y, Float:Float:z, Float:Float:angle);

// Araç rotasyonunu ayarlamak için kullanılır.
forward SetVehicleFacingAngle(vehicleid, Float:Float:angle);

// Oyuncunun aracının rotasyonunu almak için kullanılır.
forward GetPlayerVehicleRotation(playerid, &Float:Float:rotX, &Float:rotY, &Float:rotZ);

// Oyuncunun aracının rotasyonunu ayarlamak için kullanılır.
forward SetPlayerVehicleRotation(playerid, Float:Float:rotX, Float:rotY, Float:rotZ);

// Yardımcı fonksiyon: Bir vektörü belirli bir derece (açı) kadar döndürür.
Float:Float:vector_rotate(Float:Float:x, Float:y, Float:Float:z, Float:Float:angle)
{
    Float:Float:rad = angle * (M_PI / 180.0);
    Float:Float:cs = cos(rad);
    Float:Float:sn = sin(rad);
   
    Float:Float:newX = x * cs - y * sn;
    Float:Float:newY = x * sn + y * cs;
   
    return Float:Float: new newX, newY, z;
}

// Araç rotasyonunu belirli bir dereceye ayarlar.
SetVehicleFacingAngle(vehicleid, Float:Float:angle)
{
    new Float:Float:rotX, Float:rotY, Float:rotZ;
    GetVehicleRotation(vehicleid, rotX, rotY, rotZ);
   
    // Yeni rotasyon hesaplanır.
    new Float:Float:newRotX, Float:newRotY, Float:newRotZ;
    vector_rotate(rotX, rotY, rotZ, angle, newRotX, newRotY, newRotZ);
   
    // Araç rotasyonu ayarlanır.
    SetVehicleRotation(vehicleid, newRotX, newRotY, newRotZ);
}

// Oyuncunun aracının rotasyonunu alır.
GetPlayerVehicleRotation(playerid, &Float:Float:rotX, &Float:rotY, &Float:rotZ)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleRotation(vehicleid, rotX, rotY, rotZ);
}

// Oyuncunun aracının rotasyonunu ayarlar.
SetPlayerVehicleRotation(playerid, Float:Float:rotX, Float:rotY, Float:rotZ)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    SetVehicleRotation(vehicleid, rotX, rotY, rotZ);
}
Başlık: Ynt: Araç Sistemi İle Alakalı Bir Sorun.
Gönderen: marcie - 26 Kasım 2023, 01:58:08
Alıntı yapılan: benHüseyin - 25 Kasım 2023, 21:08:40
Eğer oyun modunuzda get set vehincle rotasyon infoları yoksa olmaz şöyle hata problem çözümleri.
// Bu fonksiyon, bir vektörü belirli bir derece (açı) kadar döndürür.



PAWN Kodu: Seç
forward Float:Float:vector_rotate(Float:Float:x, Float:y, Float:Float:z, Float:Float:angle);

// Araç rotasyonunu ayarlamak için kullanılır.
forward SetVehicleFacingAngle(vehicleid, Float:Float:angle);

// Oyuncunun aracının rotasyonunu almak için kullanılır.
forward GetPlayerVehicleRotation(playerid, &Float:Float:rotX, &Float:rotY, &Float:rotZ);

// Oyuncunun aracının rotasyonunu ayarlamak için kullanılır.
forward SetPlayerVehicleRotation(playerid, Float:Float:rotX, Float:rotY, Float:rotZ);

// Yardımcı fonksiyon: Bir vektörü belirli bir derece (açı) kadar döndürür.
Float:Float:vector_rotate(Float:Float:x, Float:y, Float:Float:z, Float:Float:angle)
{
    Float:Float:rad = angle * (M_PI / 180.0);
    Float:Float:cs = cos(rad);
    Float:Float:sn = sin(rad);
   
    Float:Float:newX = x * cs - y * sn;
    Float:Float:newY = x * sn + y * cs;
   
    return Float:Float: new newX, newY, z;
}

// Araç rotasyonunu belirli bir dereceye ayarlar.
SetVehicleFacingAngle(vehicleid, Float:Float:angle)
{
    new Float:Float:rotX, Float:rotY, Float:rotZ;
    GetVehicleRotation(vehicleid, rotX, rotY, rotZ);
   
    // Yeni rotasyon hesaplanır.
    new Float:Float:newRotX, Float:newRotY, Float:newRotZ;
    vector_rotate(rotX, rotY, rotZ, angle, newRotX, newRotY, newRotZ);
   
    // Araç rotasyonu ayarlanır.
    SetVehicleRotation(vehicleid, newRotX, newRotY, newRotZ);
}

// Oyuncunun aracının rotasyonunu alır.
GetPlayerVehicleRotation(playerid, &Float:Float:rotX, &Float:rotY, &Float:rotZ)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleRotation(vehicleid, rotX, rotY, rotZ);
}

// Oyuncunun aracının rotasyonunu ayarlar.
SetPlayerVehicleRotation(playerid, Float:Float:rotX, Float:rotY, Float:rotZ)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    SetVehicleRotation(vehicleid, rotX, rotY, rotZ);
}

chatgpt coding, başarılı.