Jump to content
  • 0

Question

Posted

Salut, am incercat sa modific functia de VipNameVehicle din gamemode-ul meu si primesc o erroare despre care nu imi dau seama cum sa o rezolv, daca aveti vreo idee, orice parere este acceptata si bine primita :) 

Cod

function VIPNameVehicle(vehicleid)
{
    new arrayid = OwnedVeh(vehicleid); veh_ArrayID(vehicleid);
    if(strlen(CarInfo[arrayid][cVipname]) > 3 && CarInfo[arrayid][cVipShow] == 1)
    {
        new string[100];
        if(IsValidDynamicObject(vText[vehicleid])) DestroyDynamicObject(vText[vehicleid]);

        vText[vehicleid] = CreateDynamicObject(19327, CarInfo[arrayid][cVX],CarInfo[arrayid][cVY],CarInfo[arrayid][cVZ],CarInfo[arrayid][cVRX],CarInfo[arrayid][cVRY],CarInfo[arrayid][cVRZ],-1,-1,-1,30,30);

        format(string, 100, "{%s}%s", CarInfo[arrayid][cVipnamecolor], CarInfo[arrayid][cVipname]);
        SetDynamicObjectMaterialText(vText[vehicleid], 0, string, 50, "Arial", CarInfo[arrayid][cVipSize], 1, 0xFFFFFFFF, 0, 1);

        new model = CarInfo[arrayid][cModel];
        if(model == 411)
        {
            AttachDynamicObjectToVehicle(vText, vehicleid, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0); // 1585
        } 
        else if(model == 560)
        {
            AttachDynamicObjectToVehicle(vText, vehicleid, 0.0, 0.0, 0.8, 0.0, 0.0, 0.0); // 1589
        }
        else if(model == 541)
        {
            AttachDynamicObjectToVehicle(vText, vehicleid, 0.0, -0.2, 0.62, 0.0, 0.0, 0.0); //1593
        }
        else if(model == 562)
        {
            AttachDynamicObjectToVehicle(vText, vehicleid,  0.0, -0.4, 0.75, 0.0, 0.0, 0.0); // 1597
        }
        else if(model == 451)
        {
            AttachDynamicObjectToVehicle(vText, vehicleid, 0.0, -0.5, 0.55, 0.0, 0.0, 0.0); // 1601
        }
    }
    return 1;
}   

Errori

gamemode.pwn(1585) : error 035: argument type mismatch (argument 1)
gamemode.pwn(1589) : error 035: argument type mismatch (argument 1)
gamemode.pwn(1593) : error 035: argument type mismatch (argument 1)
gamemode.pwn(1597) : error 035: argument type mismatch (argument 1)
gamemode.pwn(1601) : error 035: argument type mismatch (argument 1)

Randurile cu errorile le-am trecut in cod, multumesc anticipat.

 

3 answers to this question

Recommended Posts

  • 0
Posted

Salut @VAurel,

Tu ai creat variabila vText, care sa corespunda unui vehicul anume (exemplu: vText[vehicleid]). In liniile in care iti afiseaza erorile, nu ai trecut id-ul vehiculului pentru care ai creat acel obiect (vText), pe care vrei sa l atasezi.

Corect ar fi in felul urmator:

AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid, 0.0, -0.5, 0.55, 0.0, 0.0, 0.0); // 1601

Daca nu ai inteles, verifica pe rand ce am adaugat eu in plus mai sus, cu o linie din codul tau, de unde porneste eroarea.

Ti-am explicat cat mai simplu zic eu. 

Bafta.

  • Thanks 1

Daca te-am ajutat =>

spacer.png

  • 0
Posted (edited)
function VIPNameVehicle(vehicleid)
{
    new arrayid = OwnedVeh(vehicleid); veh_ArrayID(vehicleid);
    if(strlen(CarInfo[arrayid][cVipname]) > 3 && CarInfo[arrayid][cVipShow] == 1)
    {
        new string[100];
        if(IsValidDynamicObject(vText[vehicleid])) DestroyDynamicObject(vText[vehicleid]);

        vText[vehicleid] = CreateDynamicObject(19327, CarInfo[arrayid][cVX],CarInfo[arrayid][cVY],CarInfo[arrayid][cVZ],CarInfo[arrayid][cVRX],CarInfo[arrayid][cVRY],CarInfo[arrayid][cVRZ],-1,-1,-1,30,30);

        format(string, 100, "{%s}%s", CarInfo[arrayid][cVipnamecolor], CarInfo[arrayid][cVipname]);
        SetDynamicObjectMaterialText(vText[vehicleid], 0, string, 50, "Arial", CarInfo[arrayid][cVipSize], 1, 0xFFFFFFFF, 0, 1);

        new model = CarInfo[arrayid][cModel];
        if(model == 411)
        {
            AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0); // 1585
        } 
        else if(model == 560)
        {
            AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid, 0.0, 0.0, 0.8, 0.0, 0.0, 0.0); // 1589
        }
        else if(model == 541)
        {
            AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid, 0.0, -0.2, 0.62, 0.0, 0.0, 0.0); //1593
        }
        else if(model == 562)
        {
            AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid,  0.0, -0.4, 0.75, 0.0, 0.0, 0.0); // 1597
        }
        else if(model == 451)
        {
            AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid, 0.0, -0.5, 0.55, 0.0, 0.0, 0.0); // 1601
        }
    }
    return 1;
}   

 

Edited by hanako
  • Thanks 1
  • 0
Posted
On 7/11/2021 at 9:25 PM, shane said:

Salut @VAurel,

Tu ai creat variabila vText, care sa corespunda unui vehicul anume (exemplu: vText[vehicleid]). In liniile in care iti afiseaza erorile, nu ai trecut id-ul vehiculului pentru care ai creat acel obiect (vText), pe care vrei sa l atasezi.

Corect ar fi in felul urmator:

AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid, 0.0, -0.5, 0.55, 0.0, 0.0, 0.0); // 1601

Daca nu ai inteles, verifica pe rand ce am adaugat eu in plus mai sus, cu o linie din codul tau, de unde porneste eroarea.

Ti-am explicat cat mai simplu zic eu. 

Bafta.

Am inteles perfect din prima, si deja de cand mi-ai scris primul rand mi-am dat seama de ce ai zis :))) Mersi mult ❤️ 

On 7/11/2021 at 10:00 PM, hanako said:
function VIPNameVehicle(vehicleid)
{
    new arrayid = OwnedVeh(vehicleid); veh_ArrayID(vehicleid);
    if(strlen(CarInfo[arrayid][cVipname]) > 3 && CarInfo[arrayid][cVipShow] == 1)
    {
        new string[100];
        if(IsValidDynamicObject(vText[vehicleid])) DestroyDynamicObject(vText[vehicleid]);

        vText[vehicleid] = CreateDynamicObject(19327, CarInfo[arrayid][cVX],CarInfo[arrayid][cVY],CarInfo[arrayid][cVZ],CarInfo[arrayid][cVRX],CarInfo[arrayid][cVRY],CarInfo[arrayid][cVRZ],-1,-1,-1,30,30);

        format(string, 100, "{%s}%s", CarInfo[arrayid][cVipnamecolor], CarInfo[arrayid][cVipname]);
        SetDynamicObjectMaterialText(vText[vehicleid], 0, string, 50, "Arial", CarInfo[arrayid][cVipSize], 1, 0xFFFFFFFF, 0, 1);

        new model = CarInfo[arrayid][cModel];
        if(model == 411)
        {
            AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0); // 1585
        } 
        else if(model == 560)
        {
            AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid, 0.0, 0.0, 0.8, 0.0, 0.0, 0.0); // 1589
        }
        else if(model == 541)
        {
            AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid, 0.0, -0.2, 0.62, 0.0, 0.0, 0.0); //1593
        }
        else if(model == 562)
        {
            AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid,  0.0, -0.4, 0.75, 0.0, 0.0, 0.0); // 1597
        }
        else if(model == 451)
        {
            AttachDynamicObjectToVehicle(vText[vehicleid], vehicleid, 0.0, -0.5, 0.55, 0.0, 0.0, 0.0); // 1601
        }
    }
    return 1;
}   

 

Multumesc frate, eu am cerut doar o mica rezolvare nu un cod intreg, apreciez ❤️ 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.