Trunk System
#1

The problem is that it only works on the first car trunk loaded but all the same trunk opens to the front .
Код:
CMD:bput(playerid, params[])
	{
    new const vehicleid = GetClosestVehicle( playerid );
    new const cID = vPersonal[vehicleid];
	if( !vPersonal[ vehicleid ] ) return 1;
	if( !CheckIfIsOwner( playerid, vehicleid ) ) return Server( playerid, "You aren't the Owner of this car!");

	for(new y=1; y < MAX_PCARS; y++)
	{
	new name[32], info2[256];
  	cartrunk[cID] = troaca[playerid][y];
    new model = GetVehicleModel(cartrunk[cID]);
    for(new t=0; t < 6; t++)
	{
	    if(IsPlayerInRangeOfVehicle(playerid, cartrunk[cID], 5.0))
		{
	    	tWeapon[cartrunk[cID]][t] = g_Weaps[t];
	    	tAmmo[cartrunk[cID]][t] = g_Ammo[t];
  }
	}
	if(IsPlayerConnected(playerid))
	{
			if(IsPlayerInRangeOfVehicle(playerid, cartrunk[cID], 5.0))
			{
				if(model!=448 && model!=461 && model!=462 && model!=463 && model!=468 && model!=471 && model!=481 && model!=509 && model!=510 && model!=521 && model!=522 && model!=523 && model!=581 && model!=586 && model!=481 && model!=509 && model!=510)
				{
					for(new t=0; t < 6; t++)
					{
						if(tWeapon[cartrunk[cID]][t] != 0)
						{
	 						GetWeaponName(tWeapon[cartrunk[cID]][t], name, sizeof(name));
							format(info2, sizeof(info2), "%s%d. %s\n", info2, t+1, name);
						}
						else
						{
						format(info2, sizeof(info2), "%s%d. Empty\n", info2, t+1);
						}
					}
					ShowPlayerDialog(playerid, DIALOG_BPUT, DIALOG_STYLE_LIST, "Trunk Weapon", info2, "Select", "Cancel");
				}
				else
				{
 				SendClientMessage(playerid, COLOR_YELLOW, "  This is vehicle not have trunk!");
				}
			}
  		}
	}
return 1;
}
cID = is id from the DB



Loading vehicles after player login.

Код:
stock incarcaPersonale( playerid )
{
	for( new i; i < MAX_PCARS; ++i )
	{
	    if( !pVData[ i ][ cExist ] ) continue;
	    if( !strcmp( pData[ playerid ][ pNormalName ], pVData[ i ][ cOwner ], true ) )
	    {
     	   	troaca[playerid][i] = CreateVehicle(  pVData[ i ][ cModel ], pVData[ i ][ cLocation ][ 0 ], pVData[ i ][ cLocation ][ 1 ], pVData[ i ][ cLocation ][ 2 ], pVData[ i ][ cLocation ][ 3 ], pVData[ i ][ cColor1 ], pVData[ i ][ cColor2 ], -1 );
	        vPersonal[ troaca[playerid][i] ] = pVData [ i ][ cDBID ];
	        SetVehicleNumberPlate( troaca[playerid][i], pVData [ i ][ cPlate ] );
	        for( new comp; comp < 14; ++comp )
	        {
	             AddVehicleComponent( troaca[playerid][i] , pVData[ i ][ cMod ][ comp ] );
	        }
	    }
	}
	printf( "Loaded PCars for %s", pData[ playerid ][ pNormalName ] );
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)