Need some help on attaching objects on vehicles
#1

So I'm trying to work on a traffic advisor, but I'm having some errors, heres the code:

pawn Код:
public TrafficFlasherLeftFunc()
{
    for(new p=0; p<MAX_VEHICLES; p++)
    {
        if(TrafficLeft[p] == 1)
        {
            if(TrafficLeftState[p] == 1)
            {
                DestroyObject(tobj1[p]);
                DestroyObject(tobj2[p]);
                tobj1[p] = CreateObject(19284,0,0,-1000,0,0,0,100);
                tobj2[p] = CreateObject(19283,0,0,-1000,0,0,0,100);
                AttachObjectToVehicle(tobj1, p, -0.524999,-1.050000,0.375000,0.000000,0.000000,0.000000);
                AttachObjectToVehicle(tobj2, p, -0.524999,-1.050000,0.375000,0.000000,0.000000,0.000000);
                TrafficLeftState[p] = 2;
            }
            else if(TrafficLeftState[p] == 2)
            {
                DestroyObject(tobj1[p]);
                DestroyObject(tobj2[p]);
                tobj1[p] = CreateObject(19284,0,0,-1000,0,0,0,100);
                tobj2[p] = CreateObject(19283,0,0,-1000,0,0,0,100);
                AttachObjectToVehicle(tobj1, p, -0.375000,-1.050000,0.375000,0.000000,0.000000,0.000000);
                AttachObjectToVehicle(tobj2, p, -0.375000,-1.050000,0.375000,0.000000,0.000000,0.000000);
                TrafficLeftState[p] = 3;
            }
            else if(TrafficLeftState[p] == 3)
            {
                DestroyObject(tobj1[p]);
                DestroyObject(tobj2[p]);
                tobj1[p] = CreateObject(19284,0,0,-1000,0,0,0,100);
                tobj2[p] = CreateObject(19283,0,0,-1000,0,0,0,100);
                AttachObjectToVehicle(tobj1, p, -0.150000,-1.050000,0.375000,0.000000,0.000000,0.000000);
                AttachObjectToVehicle(tobj2, p, -0.150000,-1.050000,0.375000,0.000000,0.000000,0.000000);
                TrafficLeftState[p] = 4;
            }
            else if(TrafficLeftState[p] == 4)
            {
                DestroyObject(tobj1[p]);
                DestroyObject(tobj2[p]);
                tobj1[p] = CreateObject(19284,0,0,-1000,0,0,0,100);
                tobj2[p] = CreateObject(19283,0,0,-1000,0,0,0,100);
                AttachObjectToVehicle(tobj1, p, 0.000000,-1.050000,0.375000,0.000000,0.000000,0.000000);
                AttachObjectToVehicle(tobj2, p, 0.000000,-1.050000,0.375000,0.000000,0.000000,0.000000);
                TrafficLeftState[p] = 5;
            }
            else if(TrafficLeftState[p] == 5)
            {
                DestroyObject(tobj1[p]);
                DestroyObject(tobj2[p]);
                tobj1[p] = CreateObject(19284,0,0,-1000,0,0,0,100);
                tobj2[p] = CreateObject(19283,0,0,-1000,0,0,0,100);
                AttachObjectToVehicle(tobj1, p, 0.225000,-1.050000,0.375000,0.000000,0.000000,0.000000);
                AttachObjectToVehicle(tobj2, p, 0.225000,-1.050000,0.375000,0.000000,0.000000,0.000000);
                TrafficLeftState[p] = 6;
            }
            else if(TrafficLeftState[p] == 6)
            {
                DestroyObject(tobj1[p]);
                DestroyObject(tobj2[p]);
                tobj1[p] = CreateObject(19284,0,0,-1000,0,0,0,100);
                tobj2[p] = CreateObject(19283,0,0,-1000,0,0,0,100);
                AttachObjectToVehicle(tobj1, p, 0.375000,-1.050000,0.375000,0.000000,0.000000,0.000000);
                AttachObjectToVehicle(tobj2, p, 0.375000,-1.050000,0.375000,0.000000,0.000000,0.000000);
                TrafficLeftState[p] = 7;
            }
            else if(TrafficLeftState[p] == 7)
            {
                DestroyObject(tobj1[p]);
                DestroyObject(tobj2[p]);
                tobj1[p] = CreateObject(19284,0,0,-1000,0,0,0,100);
                tobj2[p] = CreateObject(19283,0,0,-1000,0,0,0,100);
                AttachObjectToVehicle(tobj1, p, 0.599999,-1.050000,0.375000,0.000000,0.000000,0.000000);
                AttachObjectToVehicle(tobj2, p, 0.599999,-1.050000,0.375000,0.000000,0.000000,0.000000);
                TrafficLeftState[p] = 1;
            }
        }
    }
    return 1;
}
and here are the errors:

Код:
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14692) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14693) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14702) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14703) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14712) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14713) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14722) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14723) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14732) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14733) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14742) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14743) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14752) : error 035: argument type mismatch (argument 1)
C:\Users\SugaryJesus\Desktop\JUNK\Everest Roleplay\Sever Files\gamemodes\erp.pwn(14753) : error 035: argument type mismatch (argument 1)
It only shows for the attach objects part, nothing else no clue whats going on here...
Reply
#2

Ehh can you mark the lines...where the errors appear?
Reply
#3

AttachObjectToVehicle(tobj1, p, 0.375000,-1.050000,0.375000,0.000000,0.000000,0.000000);
AttachObjectToVehicle(tobj2, p, 0.375000,-1.050000,0.375000,0.000000,0.000000,0.000000);

Its basically these codes, each of them have different cords, but they should all work
Reply
#4

Yes look, you missed the array index (at the first argument)..so write it like this:

PHP код:
AttachObjectToVehicle(tobj1[p], p0.375000,-1.050000,0.375000,0.000000,0.000000,0.000000);
AttachObjectToVehicle(tobj2[p], p0.375000,-1.050000,0.375000,0.000000,0.000000,0.000000); 
Reply
#5

Oh wow such dumb me thanks dude!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)