AttachObjectToVehicle
#1

I have tried many times to fix this, i cant figure out, i dont have any errors.
So, with this code, i can spawn only "bandit" .without objects... Where is my mistake?


Код:
#include <foreach>
Код:
new ramp[MAX_PLAYERS], minigun[MAX_PLAYERS], minigun2[MAX_PLAYERS], lol1[MAX_PLAYERS], neon[MAX_PLAYERS], bandit[MAX_PLAYERS];
Код:
public OnGameModeInit()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
		    minigun[i] = CreateObject(362, 0,0,0,0,0,0);
		    minigun2[i] = CreateObject(362, 0,0,0,0,0,0);
		    ramp[i] = CreateObject(5153, 0,0,0,0,0,0);
		    neon[i] = CreateObject(19122, 0,0,0,0,0,0);
		}
	}

Код:
public OnPlayerDisconnect(playerid, reason)
{
    DestroyObject(ramp[playerid]);
    DestroyObject(minigun[playerid]);
    DestroyObject(minigun2[playerid]);
    DestroyObject(neon[playerid]);
    return 1;
}

Код:
	if(strcmp(cmdtext, "/car", true) == 0)
	{
    	   if(lol1[playerid] == 1)
    	   {
			new Float:pos[4];
			GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
			GetPlayerFacingAngle(playerid, pos[3]);
			bandit[playerid] = CreateVehicle(568, pos[0], pos[1], pos[2], pos[3], 123,0,0);
			AttachObjectToVehicle(ramp[playerid], bandit[playerid], 0, 2.8, -0.2, -0.5, -110, 90);
			AttachObjectToVehicle(minigun[playerid], bandit[playerid], 0.2, -0.3, 1, -10, 25, 90);
			AttachObjectToVehicle(minigun2[playerid], bandit[playerid], -0.2, -0.3, 1, -10, 25, 90);
			AttachObjectToVehicle(neon[playerid], bandit[playerid], 0,-0.9,0.3,0,0,0);
			AddVehicleComponent(bandit[playerid], 1010);
			AddVehicleComponent(bandit[playerid], 1079);
			AddVehicleComponent(bandit[playerid], 1087);
                        lol1[playerid] = 0;
    	   }
    	   else if(lol1[playerid] == 0)
    	   {
    		SCM(playerid, 0xAA0909FF,"ERROR:{FFFFFF}blablabla");
    	    }
    	return 1;
	}
Код:
public OnPlayerPickUpPickup(playerid,pickupid)
{
		  if(pickupid==nvm)     return ShowPlayerDialog(playerid, nvm2, DIALOG_STYLE_LIST, "nvm3", " 1\n2\n3", "Ok", "Cancel");
          return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == nvm2)
    {
        if(response) 
        {
            switch(listitem)
            {
            case 0: blablabla
        	case 1: lol1[playerid] = 1 && ShowPlayerDialog....
            case 2: blablabla", "Ok", "Cancel");
			}
		}
        return 1;
    }
Reply
#2

Hmm
Reply
#3

Nice !!
Reply
#4

What?
Reply
#5

BUMP
Reply
#6

Wait, what exactly is happening in the current code,and what are you trying to achieve?
Reply
#7

With this code, player can spawn only "bandit" without objects:

Код:
AttachObjectToVehicle(ramp[playerid], bandit[playerid], 0, 2.8, -0.2, -0.5, -110, 90);
AttachObjectToVehicle(minigun[playerid], bandit[playerid], 0.2, -0.3, 1, -10, 25, 90);
AttachObjectToVehicle(minigun2[playerid], bandit[playerid], -0.2, -0.3, 1, -10, 25, 90);
AttachObjectToVehicle(neon[playerid], bandit[playerid], 0,-0.9,0.3,0,0,0);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)