SA-MP Forums Archive
Is There Any Way..............? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is There Any Way..............? (/showthread.php?tid=300966)



Is There Any Way..............? - Danyal - 02.12.2011

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?


Re: Is There Any Way..............? - Danyal - 03.12.2011

some body help me please.........................


Re: Is There Any Way..............? - grand.Theft.Otto - 03.12.2011

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;
}



Re: Is There Any Way..............? - Danyal - 03.12.2011

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


Re: Is There Any Way..............? - Danyal - 03.12.2011

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


Re: Is There Any Way..............? - MadSkillz - 03.12.2011

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;
}



Re: Is There Any Way..............? - Danyal - 03.12.2011

still no work i tried loop but nothing happened


Re: Is There Any Way..............? - PlayHard - 03.12.2011

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.


Re: Is There Any Way..............? - Danyal - 04.12.2011

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