Is There Any Way..............?
#1

pawn Код:
SetPVarInt(playerid, "elegy", 1);
                SetPVarInt(playerid, "elegywhite", CreateObject(18652,0,0,0,0,0,0));
                SetPVarInt(playerid, "elegywhite1", CreateObject(18652,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "elegywhite"), Elegy, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(GetPVarInt(playerid, "elegywhite1"), Elegy, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
            SetPVarInt(playerid, "daspoiler", CreateObject(1139,0,0,0,0,0,0));
            AttachObjectToVehicle(GetPVarInt(playerid, "daspoiler"), Elegy, -0.0039, -2.0976, 0.309, 0.0, 0.0, 0.0);
is there any way to attach these objects on vehicle spawn?
Reply
#2

some body help me please.........................
Reply
#3

Not too sure, try:

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    SetPVarInt(playerid, "elegy", 1);
    SetPVarInt(playerid, "elegywhite", CreateObject(18652,0,0,0,0,0,0));
    SetPVarInt(playerid, "elegywhite1", CreateObject(18652,0,0,0,0,0,0));
    AttachObjectToVehicle(GetPVarInt(playerid, "elegywhite"), Elegy, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
    AttachObjectToVehicle(GetPVarInt(playerid, "elegywhite1"), Elegy, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
    SetPVarInt(playerid, "daspoiler", CreateObject(1139,0,0,0,0,0,0));
    AttachObjectToVehicle(GetPVarInt(playerid, "daspoiler"), Elegy, -0.0039, -2.0976, 0.309, 0.0, 0.0, 0.0);
    return 1;
}
Reply
#4

that doesnt work when i putted that code
pawn Код:
error 017: undefined symbol "playerid"
then i defined

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    new playerid;
    SetPVarInt(playerid, "elegy", 1);
    SetPVarInt(playerid, "elegywhite", CreateObject(18652,0,0,0,0,0,0));
    SetPVarInt(playerid, "elegywhite1", CreateObject(18652,0,0,0,0,0,0));
    AttachObjectToVehicle(GetPVarInt(playerid, "elegywhite"), Elegy, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
    AttachObjectToVehicle(GetPVarInt(playerid, "elegywhite1"), Elegy, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
    SetPVarInt(playerid, "daspoiler", CreateObject(1139,0,0,0,0,0,0));
    AttachObjectToVehicle(GetPVarInt(playerid, "daspoiler"), Elegy, -0.0039, -2.0976, 0.309, 0.0, 0.0, 0.0);
    return 1;
}
then no error and compiler successfully but still objects arent attached on vehicle spawn
Reply
#5

i need this pretty quick and nobody is gona help me.
please help me.......................
Reply
#6

Try this
Код:
public OnVehicleSpawn(vehicleid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
	    SetPVarInt(i, "elegy", 1);
	    SetPVarInt(i, "elegywhite", CreateObject(18652,0,0,0,0,0,0));
	    SetPVarInt(i, "elegywhite1", CreateObject(18652,0,0,0,0,0,0));
	    AttachObjectToVehicle(GetPVarInt(i, "elegywhite"), Elegy, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
	    AttachObjectToVehicle(GetPVarInt(i, "elegywhite1"), Elegy, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
	    SetPVarInt(i, "daspoiler", CreateObject(1139,0,0,0,0,0,0));
	    AttachObjectToVehicle(GetPVarInt(i, "daspoiler"), Elegy, -0.0039, -2.0976, 0.309, 0.0, 0.0, 0.0);
    }
    return 1;
}
Reply
#7

still no work i tried loop but nothing happened
Reply
#8

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SetPVarInt(i, "elegy", 1);
        SetPVarInt(i, "elegywhite", CreateObject(18652,0,0,0,0,0,0));
        SetPVarInt(i, "elegywhite1", CreateObject(18652,0,0,0,0,0,0));
        AttachObjectToVehicle(GetPVarInt(i, "elegywhite"), Elegy, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(GetPVarInt(i, "elegywhite1"), Elegy, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
        SetPVarInt(i, "daspoiler", CreateObject(1139,0,0,0,0,0,0));
        AttachObjectToVehicle(GetPVarInt(i, "daspoiler"), Elegy, -0.0039, -2.0976, 0.309, 0.0, 0.0, 0.0);
    }
    return 1;
}
Try that. It will attach the objects to the vehicle when a player enters it. In my opinion OnVehicleSpawn didn't work because the vehicles didn't actually spawn as they were added or something. I am not sure, but that should make it work ^^. And OnVehicleSpawn - You need a command to make the code work that respawns the vehicles.
Reply
#9

Problem Solved I Use Local Variable's To Attach Objects To Vehicle
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)